exercises

16. dialogue notations and design

EXERCISE 16.9 [extra - not in book]

Here is a specification of an ATM in an event-oriented production rule system. The terms with initial Upper Case letters represent user events, those in lower case represent internal system events, those in <angle brackets> are external system actions.

Specification ProdR.

     Enter-card   ->    card-in
Enter-Amnt pin-in -> money-ready card-ready
Enter-PIN card-in -> pin-in
Remove-Cash money-ready -> <user gets money>
Remove-Card card-ready -> <user gets card>

(a) Explain in natural language the possible interactions allowed by this specification.
(b) Which of the following are valid traces for this specification - explain your reasoning in terms of the production rules.

Trace A.
A.1. Enter-card
A.2. Enter-Amnt
A.3. Enter-PIN
A.4. Remove-Cash
A.5. Remove-Card

Trace B.
B.1. Enter-card
B.2. Enter-PIN
B.3. Enter-Amnt
B.4. Remove-Card
B.5. Remove-Cash

answer available for tutors only

(a) The user has to enter the card, pin number and amount requested in that order, but can withdraw the money and card in either order.

(b)
Trace A.
A.1. Enter-card
A.2. Enter-Amnt
A.3. Enter-PIN
A.4. Remove-Cash
A.5. Remove-Card

NOT VALID:
After A.1. the system memory contains 'card-in'.
However, the second production rule needs 'pin-in' to be in the system memory so cannot fire when the user event 'Enter-Amnt' occurs.

Trace B.
B.1. Enter-card
B.2. Enter-PIN
B.3. Enter-Amnt
B.4. Remove-Card
B.5. Remove-Cash

VALID:
What matters is the system memory, not the order of the rules.
Playing through the scenario (more detailed than necessary in a student answer):

user action             system memory
B.1. Enter-card
card-in
B.2. Enter-PIN
pin-in
B.3. Enter-Amnt
money-ready, card-ready
B.4. Remove-Card
money-ready
B.5. Remove-Cash
empty

Other exercises in this chapter

ex.16.1 (ans), ex.16.2 (ans), ex.16.3 (ans), ex.16.4 (ans), ex.16.5 (tut), ex.16.6 (tut), ex.16.7 (tut), ex.16.8 (tut), ex.16.9 (tut), ex.16.10 (tut), ex.16.11 (open)

all exercises for this chapter