CS 4773 Object Oriented Systems
CRC Cards


Previous Topic: Vectors and Synchronization

CRC Cards
ChutesAndLadders

Next Topic: Monopoly



CRC Cards

CRC cards is a technique for object oriented design. The leters stand for Class, Responsibilities, Collaborations.

A CRC card is a 3 by 5 index card for a given class. The first line contains the name of the class.
Next is a list of responsibilities of the class, that is the public methods of that class. Finally, the collaborations are listed. These are the classes that this class needs to know about in order to implement its public methods.

Design steps:


Chutes and Ladders

In class we designed a set of CRC cards for the children's game Chutes and Ladders. We started out by listing the following classes: The we determined that the Chute and Ladder classes were really the same as they only needed to have a starting and ending position. Later in the design we found that we did not need the starting position so that the class would just contain a single integer, the ending position. We eventually eliminated this class entirely.

We also discussed eliminating the Cell class but decided to keep it.

Here is that state of the design when the class ended:


Class: Board

Responsibilities:
Display
GetCell
GetNextPlayer
Collaborations
Player
Cell

Class: Player

Responsibilities:
MakeMove
GetPosition
Display
Collaborations
Spinner
Cell
Board

Class: Spinner

Responsibilities:
GetSpin
Display
Collaborations
noner

Class: Cell

Responsibilities:
GetDestination
Collaborations
none

Class: Game

Responsibilities:
EndGameTest
Initialize
Save
Collaborations
Board
Player



Next topic: Monopoly