6.4 The CRC Card Design Process | 277
Programmers have a responsibility to develop software that is free from er-
rors. The process that is used to develop correct software is known assoftware en-
gineering.
Software engineering has many aspects. The software life cycle described in
Chapter 1 outlines the stages in the development of software. Different tech-
niques are used at each of these stages. We address many of these techniques in
this text. In this chapter we introduce methodologies for developing object-ori-
ented designs. We discuss strategies for testing and validating programs in every
chapter. We use a modern programming language that enables us to write read-
able, well-organized code, and so on. Some aspects of software engineering, such as the de-
velopment of a formal, mathematical specification for an application, are beyond the scope
of this text.
6.4 The CRC Card Design Process
There are three basic steps in developing an OOD using CRC cards. We’ve actually been us-
ing these steps in the Case Studies without naming them. The first step is to identify an ini-
tial set of object classes that seem to be relevant to the problem. In previous Case Studies,
we looked at the nouns in a problem statement as a source of possible objects. The second
step is to filter this list, eliminating duplicates or objects that aren’t really appropriate for
the computer to implement. The third step is to identify the responsibilities for the reduced
list of objects. In the Case Studies, we’ve merely listed the responsibilities, but the method-
ology we present uses scenarios to determine and refine the responsibilities.
In moving to problems that involve multiple classes, however, these steps become
more complex. We must explore how the objects interact. In the CRC card design process,
we do so through role-playing under a variety of scenarios. That is, we pretend to be the
objects, and we go through the steps required to carry out some portion of the problem’s
solution. Along the way, we identify new objects or responsibilities that are needed. We
also note special relationships between classes, such as the subclasses mentioned ear-
lier. After gaining some experience with a few initial scenarios, we identify additional sce-
narios that should be tried. We repeat the last step until we run out of ideas for scenarios
or are convinced that we’ve covered all of the necessary objects and responsibilities in
our design.
Now we look at each of these steps in turn.
Identifying the Initial Classes Through Brainstorming
The first step in solving a problem with OOD is to identify the classes of objects that are
found in the problem. There is no foolproof technique for doing this; we just have to start
brainstorming ideas and see where they lead us. A large program is typically written by a team
of programmers, so the brainstorming process often occurs in a team setting. Team mem-
bers identify whatever objects they see in the problem and then propose classes to represent
Software engineering The ap-
plication of traditional engineer-
ing methodologies and
techniques to the development
of software