showing interface dependencies in UML

2019-09-14 20:32发布

Say I have the following interface and class

UML Interface and implementing class

This has a association dependency on SomeObject like so UML Interface, implementing class and associated class

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:

UML Interface, implementing class and associated class, showing dependency from Interface to associated class

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条回答
我想做一个坏孩纸
2楼-- · 2019-09-14 21:10

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.

查看更多
登录 后发表回答