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.
Establishing Responsibilities for Problem-Domain Objects Connie’s <strong>Convenience</strong> <strong>Store</strong> 47<br />
Establish responsibilities: “who I know.”<br />
A tax category object knows its:<br />
–items.<br />
(And yes, an item knows its tax categories.)<br />
Establish responsibilities: “what I do.”<br />
What does a tax category do? Just the basic services: get, set, add (a connection), remove<br />
(a connection), and delete.<br />
Add tax category responsibilities to your model (Figure 1–31):<br />
TaxCategory<br />
category<br />
rate<br />
effectiveDate<br />
Figure 1–31: Tax category: “what I know; who I know; what I do.”<br />
Responsibilities for problem-domain transactions<br />
Transactions are moments in time in which objects interact, moments in time that a system<br />
is responsible to remember for some future need.<br />
Investigate your transactions:<br />
– sale (and its part, sale line item)<br />
– payment<br />
– session.<br />
Sale<br />
Establish responsibilities: “what I know.”<br />
n n<br />
#54. “Establish Transaction Attributes” Strategy establishing responsibilities /<br />
what I know (pattern players)<br />
• For transactions, include: number, date, time, status.<br />
• For line items, include: quantity (if it knows an item, rather than a specific item), status.<br />
What do you need here, for a sale? In this case, add these two attributes:<br />
– date and time.<br />
Item