Reputation: 2212
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.
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
Is the diamond symbol used in object i.e. instance diagrams, too? Or are links in object diagrams always just simple lines?
Upvotes: 3
Views: 3045
Reputation: 1340
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".
Upvotes: 0
Reputation: 14061
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/
Upvotes: 4