What does this relationship mean in UML?

  Kiến thức lập trình

I have repeatedly seen these relationships in UML diagrams:
enter image description here

What do these relationships mean and what are they called? I understand that the first is aggregation, the second is composition, but what does the arrow association mean? And when should these relationships be applied?

2

Aggregation:

It depicts a “has-a” relationship and represents a whole-part hierarchy where the part can exist independently of the whole.For example, a car and a wheel relationship is an aggregation. A car has wheels, but the wheel can exist without the car.

When you want to express a relationship where one object is a part of another, but it can exist independently.

Car <>—- Wheel


Composition:

It indicates a stronger form of the “has-a” relationship, i.e., a whole-part hierarchy where the part cannot exist independently of the whole.A human has a heart, and the heart cannot exist independently without the human.

When you want to express a relationship where one object is part of another, and it cannot exist independently.

Human <<>>—- Heart

LEAVE A COMMENT