Lecture Notes on Object-Oriented Programming

CRC Cards

Class / Responsibilities / Collaborators

CRC cards are a simple representation of the classes in an OO system. They are often a good way to get started when facing a new project. Physically the cards are 3x5 or 4x6 index cards.

You write the name of the class at the top of the card. On the left half of the card you write the responsibilities (which cover the class attributes via "knowing...") and on the rights side you write the collaborations (other classes) for this class.

Scenarios, use-cases, role playing, etc, can then be used to find new behavior, and make sure it is listed as a responsibility on some card.

The advantages of using low tech cards are:

  • simple, cheap, editable
  • spatial groupings for exploration of relationships: class hierarchy, object messaging
  • very practical, good at playing "what if" games with class definitions.
  • encourages seeing the separation and boundaries of abstractions.
  • easy to role play with.