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.

58 Connie’s <strong>Convenience</strong> <strong>Store</strong> Applying Patterns: Establish Problem-Domain Responsibilities<br />

Item–line item<br />

Okay. What’s next? How about this:<br />

#9. “Item–Line Item” Pattern transaction patterns<br />

• Typical object interactions<br />

howMany —> getQuantity<br />

calcOverLineItems —> calcForMe rankLineItems —> rateMe<br />

• Examples<br />

(with transaction line items) item–order line item; item–payment line item; item–rental<br />

line item; item–sale line item; item–shipment line item<br />

(with container line items) item–bin line item; item–warehouse line item.<br />

• Combinations<br />

transaction–transaction line item; subsequent transaction–subsequent transaction line<br />

item; transaction line item–subsequent transaction line item; container–container<br />

line item.<br />

For item–sale line item:<br />

– item (collection … of its sale line items)<br />

how much over interval<br />

– sale line item (worker)<br />

how much over interval.<br />

Add services to item and sale line item, and by analogy to cashier, session, and sale<br />

(Figure 1–37):<br />

Cashier<br />

howManyOverInterval<br />

howMuchOverInterval<br />

n<br />

1<br />

Item<br />

name<br />

number<br />

description<br />

price<br />

aboutMe<br />

howMany<br />

rankLineItems<br />

calcOverLineItems<br />

calcForMe<br />

Session<br />

howManyOverInterval<br />

howMuchOverInterval<br />

n 1<br />

n<br />

Sale<br />

howManyOverInterval<br />

howMuchOverInterval<br />

calcSubTotal<br />

n-1<br />

SaleLineItem<br />

howManyOverInterval<br />

calcSubTotal<br />

Figure 1–37: Some pattern instances.<br />

1<br />

quantity<br />

status<br />

aboutMe<br />

LineItem<br />

calcForMe<br />

rateMe<br />

1<br />

1<br />

n<br />

Item<br />

howManyOverInterval

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

Saved successfully!

Ooh no, something went wrong!