本文介绍了显示UML中的界面依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有以下界面和类





这对于SomeObject有一个关联依赖关系,如



接口,IDoSomething,对SomeClass有依赖关系?我应该在UML中显示吗?



显然,界面确实有一个依赖关系,但这对我来说看起来像噪音:





我在想,你可以推断出接口依赖于DoSomethingImpl的依赖关系,但是如果实现了多个接口,这将不起作用。



如果接口实现了另一个接口,那么我希望显示依赖关系,但是我担心我的UML变得不必要的复杂。



什么是合适的事情?

解决方案

你用来显示依赖关系的方式是完全正确的。这不是噪音,因为您无法从其他关系中获取此信息。另一方面,你不必显示依赖,特别是这种关系是显而易见的(你们在这个参数和操作结果中都有这个类)。



如果你坚持明确地显示依赖关系,但是你会害怕它会降低图表的清晰度,而不是增加图表,你可以将它放在一个单独的图上。



I将创建一个可追溯性的依赖(仅当您的工具支持它),但将其隐藏在图表上。


Say I have the following interface and class

This has a association dependency on SomeObject like so

Does the interface, IDoSomething, have a dependency on SomeClass? Should I show this in UML?

Clearly the interface does have a dependency but this looks like noise to me:

I was thinking that you could infer the interfaces dependency from DoSomethingImpl's dependencies, but this wouldn't work if it implemented multiple interfaces.

If the interface implemented another interface then I would expect that dependancy to be shown, but I'm worried about my UML becoming unnecessarily complex.

What would be a suitable thing to do?

解决方案

The way you have used to show dependency is fully correct. It's not a noise since you can't derive this information from other relationships. On the other hand you don't have to show a dependency, especially that this relationship is obvious (you have this class referred in both parameter and result of operation).

If you insist on explicit showing the dependency but you're afraid it'll decrease clarity of diagram rather than increasing it, you can put it on a separate diagram.

I would create a dependency for traceability purposes (only if your tool supports it) but hide it on diagrams.

这篇关于显示UML中的界面依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!