showing interface dependencies in UML

2019-09-14 20:44发布

问题:

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.