Object-Oriented Design
Identifying Relationships (or Collaborations)
- Identify object relationships, e.g. what objects need to know about what other objects, what objects are part of other objects.
- Terminology: collaboration; aggregation/has-a relationships;
knows-about relationships
(Note: is-a relationships
are class relationships, not object relationships. They should
be handled separately, usually by inheritance.)
Example: BlackJack Program
- Card:
- Deck: has cards
- Dealer: has deck, has cards (or hand, which has cards), knows about player(s)
- Player: has cards (or has hand, which has cards)