20.02.2013 Views

Connie's Convenience Store - About Peter Coad

Connie's Convenience Store - About Peter Coad

Connie's Convenience Store - About Peter Coad

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.

Establishing Responsibilities for Problem-Domain Objects Connie’s <strong>Convenience</strong> <strong>Store</strong> 39<br />

Responsibilities for tangible things<br />

Establish responsibilities for tangible things in the store:<br />

– item<br />

– register<br />

– cash drawer<br />

and<br />

– tax category.<br />

You’ll work on sale and other transactions, immediately after that.<br />

Item<br />

Establish responsibilities: “what I know.”<br />

An actual item is described by its item number, description, universal product code<br />

(UPC), expiration date, price, and whether it’s taxable or not.<br />

An item object “knows” its values for those same attributes (Figure 1–25):<br />

– number<br />

– description<br />

– UPCs<br />

– prices<br />

– taxable (either it’s taxable or it’s not).<br />

number<br />

description<br />

UPCs<br />

prices<br />

taxable<br />

Figure 1–25: Item: “what I know.”<br />

Wait a minute!<br />

Some of these attributes seem to have repeating values. That’s a good place to look<br />

for additional objects.<br />

Consider UPC<br />

An item object potentially knows a collection of UPC values.<br />

Using an attribute which has a number of repeating values is not a problem.<br />

Item

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

Saved successfully!

Ooh no, something went wrong!