Question

I have a super class, that 40 other clases inherit, at this point I would like to simplify the diagram, to be exact all the inheritance relations (40 relations point to a single class) all these "arrows" just make the diagram a complete mess, Is it posible to simplify this?

Was it helpful?

Solution

There is no direct way to simplify such case in UML Specs, but really 40 classes to inherit from one class? I think you may need to re-consider your design again.

In general, you can omit attributes and methods from classes, that way is better at least.

OTHER TIPS

Are you using inheritance for code re-use? I have never encountered a scenario where there are 40 subclasses. Anyways, one idea is to group the logically related classes into 1 single package diagram and then have package relations.

I would like to offer few suggestions though

  1. UML diagrams are 90's ;-). In the current world of agile, I see little use of those diagrams
  2. Look into tools that can reverse engineer your code and create class and sequence diagrams when needed. This helps you to VISUALIZE only the relevant parts of an application ON-DEMAND
  3. Read about sub-typing versus sub-classing

This is a good question because I had a similar problem in one of my projects. What I have done is to reduce the size of the each class in order just to have the name displayed. I have then selected a circular + hierarchical layouts and moved with my mouse all these links.

The result was brilliant. The tool I used was EclipseUML Omondo.

I would suggest the following:

**

  • SCENARIO 1

**

If you do not plan on using the model for code generation:

  • Place all the subclasses into a package. Give this package a name to indicate that all it's contained elements / classes inherits from the specific super class. For instance, if the super class is named "SuperFoo", I would call the package "SuperFoo_SubTypes"
  • Place a note in the package to indicate that all the classes in the package inherits from the super class.

**

  • SCENARIO 2

**

You do indeed plan to generate code from your model:

Option 1 I would perhaps suggest that you draw all the inheritance associations as per normal, and then hide the super class using the hide functionality on your modelling tool.

Option 2 Use the alternative notation for describing inheritance/generalization by, for each of the subclasses, writing out the name of the superclass in italic font and in the top right-hand corners of the subclass elements. This method is briefly explained in this article: http://www.sparxsystems.com/resources/uml2_tutorial/uml2_classdiagram.html This will of course depend on whether your modelling tool supports this notation.

I hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top