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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

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

What’s the same? Just the basic services.<br />

What’s different?<br />

At some point, an authorized payment needs to be authorized. So you can think of<br />

an authorized payment object as one that can authorize itself. Add a service called:<br />

– authorize.<br />

Add payment (and kinds of payment) responsibilities to the object model. Be sure<br />

to include authorized payment, too (Figure 1–35):<br />

Cash<br />

cashTendered<br />

Payment<br />

amount<br />

Check<br />

Figure 1–35: Payments and kinds of payments: “what I know; who I know; what I do.”<br />

Session<br />

After all of that, a session will seem like a cakewalk.<br />

It is.<br />

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

What does a session object know?<br />

The attributes are:<br />

– start date<br />

– start time<br />

– end date<br />

– end time.<br />

1<br />

bankRoutingNumber<br />

accountNumber<br />

amtTendered<br />

n<br />

AuthorizedPayment<br />

authorizationCode<br />

authorize<br />

Sale<br />

calcDiscount<br />

Charge<br />

cardNumber<br />

cardType<br />

expirationDate

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

Saved successfully!

Ooh no, something went wrong!