Connie's Convenience Store - About Peter Coad
Connie's Convenience Store - About Peter Coad
Connie's Convenience Store - About Peter Coad
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
76 Connie’s <strong>Convenience</strong> <strong>Store</strong> Working Out Human-Interaction Dynamics with Scenarios<br />
Scenario: make a sale<br />
This scenario consists of a number of shorter scenarios:<br />
– start sale<br />
– sell item<br />
– total the sale<br />
– gets payment by check<br />
– complete the sale.<br />
“Start sale” scenario<br />
Here is the scenario view (Figure 1–51):<br />
SaleWindow<br />
startSale<br />
display<br />
startSale saleWindow.startSale<br />
display<br />
create<br />
create<br />
Figure 1– 51: The “start sale” scenario view.<br />
Note that a sale window knows its corresponding receipt. That’s something new,<br />
something you need to add to the object model.<br />
Note also that basic services (for an object: get, set, add a connection, remove a<br />
connection; for a class: create) appear in scenarios as needed. That’s just fine.<br />
“Sell item” scenario<br />
Here is the scenario view (Figure 1–52):<br />
Sale Receipt<br />
create<br />
addHeadingLine<br />
create<br />
addHeadingLine<br />
Scenario: start sale.<br />
Scenario constraint:<br />
0.1 seconds, 9 out of 10 times,<br />
0.5 seconds max.<br />
Sale.create (session, store; sale)<br />
Receipt.create (sale ; receipt)<br />
receipt.addHeadingLine<br />
saleWindow.display