(^274) | Object-Oriented Software Design and Implementation
MAX_VALUE
MIN_VALUE
parseDouble
compareTo
Public
interface Private^ data
and methods
Figure 6.2 An Object and Its Public Interface
(^2) Originally published in: Kent Beck and Ward Cunningham, “A Laboratory for Teaching Object-Oriented
Thinking,”OOPSLA ‘89 Proceedings, SIGPLAN Notices24(10): 1–6, October 1989.
In Figure 6.2, we picture aDoubleobject as having a private part and a public part. The pri-
vate part includes fields and methods that the user cannot access and doesn’t need to know
about to use the object. The public part, shown as ovals in the side of the object, represents
its public interface: values and operations that are available to programmers wishing to use
the object.
6.3 Object-Oriented Design
Now we turn to the process of developing a problem solution using OOD. Our goal is to de-
velop a design that captures the information needed to program a solution to a problem. Our
design should not be at the level of detail of an actual program, however. That is, we want
a way to write out a solution without becoming distracted by programming language syn-
tax. As we have said before, it is important to think first and code later. In this section, we
introduce an informal technique for developing object-oriented designs, known as CRC
cards.^2
The first step in OOD is to identify the major objects in the problem. We identify the ab-
stract properties of each object, and use these to define the classes that we need. Each class