CRC cards

Class-Responsibility-Collaborator cards are a technique useful for analyzing a problem in an object-oriented manner. The technique could be used as part of requirements capture. The steps involved are:

  1. For a group of about 5 or six people.
  2. Meet in a democratic setting - everyone around the same table is good.
  3. Have a set of file cards (3 by 5 inches). Designate one person as the class writer.
  4. From a vision statement of the project develop one or more scenarios of how the system will be used.
  5. Brainstorm to produce a set of classes by looking at the vision and/or the scenarios. To start with each object, however small, should be a class. Write the class names at the top of separate cards.
  6. Think through the classes with respect to the system as envisaged, and try to eliminate unnecessary classes. Typically the users of the system will not get classes, but the various parts of the system will.
  7. Distribute the cards to the members of the group arbitrarily so that everyone gets about the same number.
  8. Each person looks at his or her cards and, thinking anthropomorphicly, develops a set of responsibilities for objects of the class on the card. These are written on the left portion of the card, below the class name. Responsibilities are typically things to store, and computations to be carried out.
  9. For each responsibility, think through any inputs that are needed. These will come from other classes, and are the collaborators. Ask the group if they can provide a piece of information, and write the name of that class to the right of the responsibilities. Sometimes, new classes can be discovered when no class can provide that piece of information.
  10. Do a walkthrough of all scenarios to make sure it works with the cards as the group has them developed. Each card holder plays the role of objects of that class, and responds to messages from other objects - again being anthropomorphic.
  11. If a card gets too full either with responsibilities or collaborators, consider breaking the class into two or more new classes.