Lecture Notes on Object-Oriented Programming

The Quality of Classes and OO Design

This collection of notes on OOP was never meant to stand alone. It also represents a view of OO circa early to mid 1990s. Some people still find them useful, so here they are, caveat emptor. Special thanks to Gilbert Benabou for taking to time to compile the first printable version of this document and inspiring us to provide it.
[PDF]
Printable Version

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.