UML - Diagram class - Relationships

This is not so easy to know which relationships and graphic to use to describe a situation.
But what we know for sure, is that the classes are linked.

Let's see this in details.

Association

An association is graphically represented by a simple line.
This is a weak link between two or more classes.
For example a customer can make an order.
In this case, the customer is linked by this order, and the order as well by the customer.

Aggregation

An aggregation is graphically represented by a line ending by an empty diamond.
This is a middle link between two classes exclusively that represents a container and contents.
For example, a building may have people inside.
If we remove this building from the street, people still exist.

Composition

An composition is graphically represented by a line ending by a filled black diamond.
This is a strong link between two classes exclusively that represents a container and contents.
For example, a building has rooms.
If we remove this building from the street, rooms are not existing anymore.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.