Topic: Composition and Aggregation
COMPOSITION
The "has-a" relationship defines composition
A black diamond is connected to the class that "has"
e.g. ATM has a Screen
[ATM]<X>-----[Screen]
According to UML, composition has the following properties
1. Only one class can represne the whole (Diamond can only go on one end of the line)
2. The parts in the composition relationship exist only as long as the whole, and the
whole is responsible for the creation and destruction of its parts.
(e.g. If ATM destoyed, then screen destroyed)
3. A part may belong to nly one whole at a time
AGGREGTION ( A weaker form of composition )
A hollow diamond is connected to the class
e.g. A personal computer and a monitor
[Computer]<>-----[Monitor]
The two parts can exist independently and do not meet the three requirements above