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.

Working Out Human-Interaction Dynamics with Scenarios Connie’s <strong>Convenience</strong> <strong>Store</strong> 73<br />

#128. “Where to Begin a Scenario” Strategy working out dynamics with scenarios<br />

• Begin with a PD object’s service, an HI object’s service, or an SI object’s service.<br />

So what human interaction do you need, to get something useful done, like make a<br />

sale?<br />

– log on<br />

– make a sale<br />

– log off.<br />

Scenario: log on<br />

Here you go.<br />

Start on the scenario view.<br />

First, get the corresponding cashier object and ask it to verify the password that was<br />

entered (Figure 1–48):<br />

LogonWindow<br />

logon<br />

<strong>Store</strong><br />

getCashierForNumber<br />

Cashier<br />

verifyPassword<br />

logon logonWindow.logon<br />

getCashierForNumber<br />

store.getCashierForNumber (number ; cashier)<br />

verifyPassword cashier.verifyPassword (password ; result)<br />

Figure 1–48: The “log on” view (round I).<br />

Scenario: log on.<br />

Scenario constraint:<br />

0.1 seconds, 9 out of 10 times,<br />

0.5 seconds max.<br />

Next, create a session; then tell the register object to remember it.<br />

To create and initialize a new object in a class, just send the class the message:<br />

Class.create (initial values ; object).<br />

Here it goes (Figure 1–49):

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

Saved successfully!

Ooh no, something went wrong!