previous |
start |
next
CRC Cards
- As you list responsibilities and collaborators,
think about the member functions the collaborators might need to
help with the task.
- Example: To computer the total, the invoice
needs to ask each item about its total price.
- Therefore the Item class is a
collaborator.
- Does the Item class have a "get total
price" member function? If not, add one to its card.
- Many people find it helpful to group cards on a
table so that the collaborators are close to each other, and to
simulate tasks by moving tokens (such as a coin) from one card to
the next to indicate which object is currently active.
- Responsibilities that you list on the CRC card
are on a high level, and may need two or more member functions for
carrying out.
- The CRC method is an informal process:
- Be creative and discover the classes and their
responsibilities.
- Cross out, move, or split
responsibilities.
- Rip cards up if they become too
messy.
previous |
start |
next