Java Reference
In-Depth Information
Using CRC cards
The next step in our design process is to work out interactions between our classes. In order to
do this, we shall use a method called CRC cards . 1
CRC stands for Class/Responsibilities/Collaborators. The idea is to take cardboard cards (nor-
mal index cards do a good job) and use one card for each class. It is important for this activity
to do this using real, physical cards, not just a computer or a single sheet of paper. Each card is
divided into three areas: one area at the top left, where the name of the class is written; one area
below this, to note responsibilities of the class; and one area to the right for writing collabora-
tors of this class (classes that this one uses). Figure 13.1 illustrates the layout of a CRC card.
Figure 13.1
A CRC card
Exercise 13.2 Make CRC cards for the classes in the cinema booking system. At this
stage, you need only fill in the class names.
Now we have a first approximation to the classes needed in our system, and a physical rep-
resentation of them on CRC cards. In order to figure out necessary interactions between the
classes in our system, we play through scenarios. A scenario is an example of an activity that
the system has to carry out or support. Scenarios are also referred to as use cases. We do not
use that term here because it is often used to denote a more formal way of describing scenarios.
Scenarios (also
known as “use
cases”) can be
used to get an
understanding of
the interactions in a
Playing through scenarios is best done in a group. Each group member is assigned one class (or
a small number of classes), and that person plays their role by saying out loud what the class
is currently doing. While the scenario is played through, the person records on the CRC card
everything that is found out about the class in action: what its responsibilities should be and
which other classes it collaborates with.
CRC cards were first described in a paper by Kent Beck and Ward Cunningham, titled A Laboratory
For Teaching Object-Oriented Thinking . This paper is worth reading as information supplemental to this
chapter. You can find it online at or by doing a
web search for its title.
Search WWH ::

Custom Search