mattumotu
mattumotu

Reputation: 1514

showing abstract class dependencies in UML

If I have the following model UML 1

Would it be acceptable to reduce this to the following? UML 2
My logic would be: SomeClassA and SomeClassB inherit BaseSomeClass (and it's dependencies) therefore we can deduce SomeClassA and SomeClassB will depend on SomeObject.

Is this (my final UML) technically correct? Is it reasonable (Whether or not technically correct)? Would it be different if DoSomething on BaseSomeClass was an abstract method?

I have a feeling the answer will be similar to my question on showing interface dependencies in UML but I feel this is different enough to merit its own question.

Upvotes: 1

Views: 1012

Answers (2)

qwerty_so
qwerty_so

Reputation: 36313

Inheritance means, that you make some kind of "abstract clone". In other words, it has not only the general class' attributes/operations, but also its dependencies. In that way your second diagram is preferred. The first is not wrong, but the two dependencies from the specialized classes are already present and must not be repeated.

To cite Einstein: Everything Should Be Made as Simple as Possible, But Not Simpler

Upvotes: 2

granier
granier

Reputation: 1789

For me your second diagram with one dependency only is the good one.

Looking at your diagram, I have some questions: - why do you want to show dependencies so precisely ? As already commented on your other question, that's possible, that's make sense but, for me, in most of UML class diagram all dependencies are not shown (even if they are modeled).

  • your method as a parameter of type SomeObject and return a SomeObject, does your class gets an attribute of type SomeObject. If this is the case, the relation is an association instead of a dependency.

Upvotes: -1

Related Questions