13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

280Chapter 12Analysis and Design: Seeking the Objects12.2FACING THE BLANK PAGESo, 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 doyou c<strong>on</strong>fr<strong>on</strong>t the paralyzing blank white of your whiteboard, terminal sessi<strong>on</strong>,or easel?The simplest way is to start with real-world objects. Stop thinking abouteverything you have read about object-oriented programming. Instead, askyourself, “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 <strong>on</strong>ly real objects we have are people—the users—and accounts, that is,named pools of m<strong>on</strong>ey. We know that users get accounts from “above,” andthat they may break those pools down into subaccounts, which they may ownor delegate to other users.At the broadest level, then, we seem to have two “classes” or types ofreal-world objects: Accounts and Users.12.3USING CRC CARDSSo, we need two classes. But what goes into those classes? How do we go aboutputting the substance into this simplistic framework?In their now (semi)famous paper presented at the object-oriented programmingc<strong>on</strong>ference OOPSLA in 1989, Kent Beck and Ward Cunningham introduceda simple, practical design tool for object-oriented design based <strong>on</strong> asimple, practical 3x5 file card. The CRC cards for our classes are shown inFigures 12.1 and 12.2.But we are getting a bit ahead of ourselves. These CRC cards are an endproduct of analysis. They are the starting point for coding. Let’s talk a little bitabout what is <strong>on</strong> these cards and how we came to that c<strong>on</strong>tent.12.4FINDING THE OBJECTSThe basic technique for doing OOA 1 with CRC cards is to start with a stackof blank cards. Assemble a design team (this may be <strong>on</strong>e pers<strong>on</strong>, or this may1. (object-oriented analysis)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!