showing interface dependencies in UML

﹥>﹥吖頭↗ 提交于 2019-12-25 06:46:26

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/42419698/showing-interface-dependencies-in-uml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!