0

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?

  • If you think, yes, Blackbird appears to be derived from FlyingThing only: then there must be some standard UML syntax to indicate that this is not the case.

  • If you think, no, there might be other base classes that the author of the diagram omitted: then this answers my question and I was just seeing problems where actually there are none. :-)

1
  • right :) I'll delete my comment
    – stan0
    Oct 11, 2013 at 11:07

3 Answers 3

0

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

1
  • Thanks, Red Beard, for pointing out that omissions (without any special marking) are perfectly fine in a class diagram. Dec 4, 2013 at 23:07
0

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).

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.