Lecture Notes on Object-Oriented Programming

CRC Cards

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

Table of Contents
  1. Introduction: Motivation for OO
  2. The OO Paradigm
  3. Visualizing Program Execution
  4. Naming Conventions
  5. The Object Model
  6. Abstraction and Identity
  7. Messaging
  8. Encapsulation & Modularity
  9. Hierarchy
  10. Object-Oriented Typing
  11. OO Concurrency & Persistence
  12. OO Development Process
  13. OO Analysis Techniques
  14. Pitfalls in OO Analysis
  15. UML Notation
  16. CRC Cards
  17. OO Class Relationships
  18. Object Oriented Aggregation
  19. Object Oriented Interitance
  20. Other Object Oriented Class Relationships
  21. Object Oriented Instantiation
  22. Object Oriented Polymorphism
  23. Review of OO Programming
  24. The Quality of Classes and OO Design

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.