Java Reference
In-Depth Information
12.2
F ACING THE B LANK P AGE
So, you have some requirements. Maybe you even have some UI prototypes.
How do you turn that into an object-oriented design for Java classes? How do
you confront the paralyzing blank white of your whiteboard, terminal session,
or easel?
The simplest way is to start with real-world objects. Stop thinking about
everything you have read about object-oriented programming. Instead, ask
yourself, “What are the real objects involved in this problem?”
In our case, the more you look at it, the simpler it gets. For the moment,
the only real objects we have are people—the users—and accounts, that is,
named pools of money. We know that users get accounts from “above,” and
that they may break those pools down into subaccounts, which they may own
or delegate to other users.
At the broadest level, then, we seem to have two “classes” or types of
real-world objects: Accounts and Users.
12.3
U SING CRC C ARDS
So, we need two classes. But what goes into those classes? How do we go about
putting the substance into this simplistic framework?
In their now (semi)famous paper presented at the object-oriented program-
ming conference OOPSLA in 1989, Kent Beck and Ward Cunningham intro-
duced a simple, practical design tool for object-oriented design based on a
simple, practical 3x5 file card. The CRC cards for our classes are shown in
Figures 12.1 and 12.2.
But we are getting a bit ahead of ourselves. These CRC cards are an end
product of analysis. They are the starting point for coding. Let's talk a little bit
about what is on these cards and how we came to that content.
12.4
F INDING THE O BJECTS
The basic technique for doing OOA 1 with CRC cards is to start with a stack
of blank cards. Assemble a design team (this may be one person, or this may
1. (object-oriented analysis)
Search WWH ::




Custom Search