aggregation association in object diagram

2.9k Views Asked by At

Associations between classes (in class diagrams of course) are an abstraction for a set of links between different objects (in object diagrams). An aggregation is a special kind of association and it has a special symbol, the diamond.

A House has many (zero to many) windows.

enter image description here

The object names in the following diagrams should actually be underlined. My drawing aid yuml for this quick pictures has no obvious tweak for this, so I hope this is not too confusing. The only difference in both pictures is the diamond signs in the first.

my:House has side:Window
         has back:Window
         has front:Window

enter image description here

Is the diamond symbol used in object i.e. instance diagrams, too? Or are links in object diagrams always just simple lines?

enter image description here

2

There are 2 best solutions below

5
Christian On

You should use the diamond on a link as well - obviously only if the association is an aggregation.

Btw. object names (and type) should be underlined to distinguish them from classes easier.

See UML 2.4 Superstructure 7.3.22 and figure 7.52 in http://www.omg.org/spec/UML/2.4/Superstructure/PDF/

0
dulaj sanjaya On

There is something wrong in your diagram. Because relationship between House and window should be a composition, not aggregation. If we take one specific window, that window is owned by one and only one house. If the house were to die, window will also die. So this is composition.

Answer to your question is, "we don't need to show aggregation and composition in object diagrams".