What does the diamond sign mean in UML class diagrams?

Consider the two diagrams below. The top contains a simple arrow on the right end, and the bottom contains an arrow with a rhombus on the left end and a simple arrow on the right end. The great GoF book uses both of these types of charts.

I want to understand what diamond means in the second case, and which of the two gives a closer relationship between Customer and Order .

Is the Customer class responsible for the life cycle of the Order class in either of two cases?

enter image description hereenter image description here

+57
design design-patterns uml class-diagram
Feb 28 '13 at 17:17
source share
3 answers

If there is no diamond , then we have a simple connection .

If the diamond is left empty , it means that it is an aggregate . This attitude is stronger than simple association. In this case, the Customer combines the Orders.

If the diamond is black , it means that it is a composition that is even stronger than aggregation, since an aggregated class cannot be aggregated by other classes. His "life" depends on the container.

I think this is explained a little more clearly:

+86
Feb 28 '13 at 17:35
source share

The client and the order are an "yes" relationship, because if the client ceases to exist, he makes his order. Therefore, there is a life cycle relationship between the container (client) and the instances within that container (order). When a container ceases to exist, all its instances.

On the other hand, if we say that the client has a book. In this case, we have a has-a relationship. Because if the client ceases to exist, the book is still available.

+16
Aug 10 '14 at 15:57
source share

This means aggregation. From Wikipedia:

In UML, it is graphically represented as a form of a hollow diamond on the containing end of a tree class with a single line that connects the containing class to the contained class. An assembly is a semantically extended object that is considered to be a unit in many although physically it is made up of several smaller objects.

http://en.wikipedia.org/wiki/Class_diagram

+8
Feb 28 '13 at 17:20
source share



All Articles