EXERCISE 16.10 [extra - not in book]
Using an STN (or other dialog notation) define the dialog of a 4 function calculator
answer available for tutors only
N.B. there is no single right answer to this. These are three possible answers.
One possibility is to consider every possible state of the calculator, starting off with a display blank apart from a '0'. Typing a '0' leaves it as it is (not 00). Typing a '1' changes it to show a 1. Typing further digits adds them to the end. Even without considering the arithmetic operations, the number of states here is clearly far too large. However, for simple devices this would be an appropriate approach.
This STN just looks at the number of digits showing on the calculator. Note, however, that it has two special states: one corresponding to the empty display (just a single 0) and one for 'showing result'. The 'showing result' state is important because in this state digits aren't added to the end of the display, but instead replace it - try it out on a calculator.
This last solution focuses purely on the distinction between when you are in the middle of typing and this special 'showing result' state. One might come to this straightaway, or, after looking at solution 2 , one might notice that all the 'n digits' states behave similarly, which suggests this 'minimal' STN. However, has this gone too far? For example there is no difference in this STN between '=' and other operations. Is this purely a semantic difference that doesn't need to be reflected in the dialog?
These three different dialogs show different levels of detail. Which one is most appropriate would depend on the purpose.