Reputation: 890
If I have multiple objects that are aggregates of one object like so:
and they all have the same multiplicity, can I draw them as a branched line like below?
Upvotes: 6
Views: 2540
Reputation: 12922
Complementing Bellekens' answer, tools such as PlantUML offer support for combining the line on inheritance, sometimes called "shared target style."
Here's an example in PlantUML:
skinparam style strictuml
hide empty members
skinparam groupInheritance 3
class S
class A extends S
class B extends S
class C extends S
My intuition is that this is generally OK for this relationship because inheritance doesn't take multiplicities or names on the ends. Doing it with aggregation is less precise, even if it makes the diagram less busy.
Upvotes: 3
Reputation: 13784
Yes, you can but I wouldn't recommend it.
In fact I've never seen it used in an industry model and I don't allow that notation to be used in any of my models. From the image below I cannot clearly distinguish whether Window is connected to the three classes below, or if Slider is connected to Panel and Header or...
I would only use that notation for Generalizations and Realization
The UML specs specify the following:
Figure 11.34 shows a similar model using the notational option of sharing the same source segment between multiple compositions. The multiplicity and name adornments on the shared end apply to all of the compositions. The model values for absent adornments on the merged segment, such as property modifiers or visibility, may differ.
Upvotes: 5