Connie's Convenience Store - About Peter Coad
Connie's Convenience Store - About Peter Coad
Connie's Convenience Store - About Peter Coad
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Selecting Problem-Domain Objects Connie’s <strong>Convenience</strong> <strong>Store</strong> 17<br />
Payment<br />
Payments are important, too. No kidding!<br />
(<strong>Peter</strong>) What kinds of payments do you accept?<br />
(Connie) Cash, check, charge, or a combination of those.<br />
(<strong>Peter</strong>) Really, a combination?<br />
(Connie) Yes, especially in the wee hours of the morning. You’d be surprised.<br />
(<strong>Peter</strong>) I’ll take your word for it.<br />
Cash, check, and charge are kinds of payments.<br />
Do you need to know and do different things, based upon the kind (or kinds) of<br />
payment? Probably so. So add these specialized classes to your object model. As you<br />
go along, you might end up sliding them over into the “not this time” bucket. And that’s<br />
okay. You’re learning more and more about what’s really needed for this system under<br />
consideration.<br />
Here’s how to model gen-spec (Figure 1–7):<br />
Payment<br />
Cash Check<br />
Charge<br />
Figure 1–7: Gen-spec.<br />
The gen-spec icon is a semicircle. Generalizations connect to the rounded edge;<br />
specializations connect to the straight edge.<br />
By convention, a generalization class may or may not have objects; lowest-level<br />
specialization classes must have directly corresponding objects. Here, the generalization<br />
class does not have directly corresponding objects.<br />
Session<br />
Sessions? Are they important?<br />
Yes. Based upon the system features, you need to assess cashier performance. To<br />
make that calculation, you will probably want to know all of the corresponding sessions<br />
for that cashier.<br />
Adding transactions to your object model<br />
Add the following classes to your object model:<br />
– sale, sale line item<br />
– payment, check, cash, charge<br />
– session.<br />
See Figure 1–8: