Class Association
Class association specifies the structural relationship between classes. The concept of multiplicity discussed below is very closely tied to class associations.
Multiplicity
Multiplicity is used to indicate the number of instances of one class linked to one instance of the other class.
- [ 1 ] ------- No More than One
- [ 0..1 ] ---- Zero or One
- [ * ] ------- Many
- [0..* ] ----- Zero or Many
- [1..* ] ----- One or Many
Navigability
When Class A contains the information required to reach Class B, then the navigability is from Class A to Class B. In other words, Class A knows about Class B, but not vice versa.
An instance of the LogAbstraction class internally maintains a LoggerBridge object and hence will be able to reach it directly. Hence a LoggerBridge object is navigable from a LogAbstraction instance.
It is also possible for the navigability to be bidirectional. In that case, the solid line of association between the two classes either contains arrowheads on both the ends or none.
whole–part relationship
Composition
Class A contains Class B.This statement denotes a strong ownership between Class A, the whole, and Class B, its part. In other words, the part class cannot meaningfully exist on its own without the whole class.
- A line item is part of an order.
- A line item cannot exist without an order.
Aggregation
This is a lighter form of composition. The whole class plays a more important role than the part class, but unlike the case of composition, the part class can meaningfully exist on its own without the whole class.
- A Player is part of a Team.
- A Player can be part of more than one Team and hence, when a Team is dissolved, the Player still remains.
No comments:
Post a Comment