Daniel Wolf
Daniel Wolf

Reputation: 13673

How to omit base classes in UML class diagram

In an UML class diagram, how do I omit irrelevant base classes without giving a wrong impression?

Let's consider the following class hierarchy:

Class hierarchy

I want to illustrate the fact that both Blackbirds and Airplanes are FlyingThings. But I don't want to clutter my UML class diagram with the entire ancestry of Blackbird.

I could simply leave out Bird, Animal, and LivingOrganism, drawing only the three "relevant" classes. But that would look as if Blackbird only derived from FlyingThing and from nothing else.

To prevent this wrong impression, I might consider including the Bird class after all, leaving out only Animal and LivingOrganism. But then it would look as if Bird had no base classes at all. Bottom line: Wherever I do the cut, it will always look as if one class had fewer base classes than it actually has.

What I'm looking for is some way to indicate that "this class has other base classes besides the ones shown, but I can't be bothered to draw them all." I imagine something along the lines of an ellipsis. Is there any standard way of expressing this?

Edit:

I made up the classes in this diagram to illustrate the question. So the question is not about whether multiple inheritance or this particular class design make sense. Let's assume they do. This question isn't about a particular UML modelling tool, either - let's assume we're working with pen and paper here.

To re-phrase my question: Imaging you saw a diagram containing just the three highlighted classes and nothing else. Would you assume that this diagram represents the whole truth and that Blackbird has no other base classes besides FlyingThing?

Upvotes: 0

Views: 1101

Answers (3)

user2511414
user2511414

Reputation:

My solution is specifying the super class with its name(definition), also you would provide some note to ensure that target developer won't mixup. example: enter image description here and by the way, I have to say, this is not belong to ISO. Coffee effects.

Upvotes: 0

observer
observer

Reputation: 3005

In addition to what @Red Beard rightly said, some tools give you the possibility to add hyperlinks to other diagrams (for example, enterprise architect does):

enter image description here

So you could add a link to another diagram that unveils the full inheritance ancestry.

But first consider this:

Does your class Blackbird really inherit from both FlyingThing and Bird? Possible in some languages, but not clever design.

Or is your generalization to FlyingThing in fact the implementation of an interface? If so, you want to use the correct connection type (as indicated in the image).

Upvotes: 0

Red Beard
Red Beard

Reputation: 3506

I am pretty sure that you would find a solution per designer... A diagram exposes a part of the entire model and the only a part, so the whole problem is which part? The response to this question is simply it depends of what you want to show for the understanding of your problem.

Regards,

BR

Upvotes: 0

Related Questions