16. dialogue notations and design


Repeat the above exercise using different notations, grammars, production rules, JSD or CSP. You will need to specify the whole system from the main menu to the individual submenu selections such as circle drawing. Note the problems you have with each notation.


Below are partial descriptions in BNF and production rules. As a class exercise, different notations could be allocated to different groups of students and the answers compared.

BNF description

The BNF description is quite straightforward (if a little tedious). We give the description for the main menu, part of the graphics submenu and the text submenu. The line drawing is already described in Section 6.8.1 as is the definition of position-mouse.

     drawing-tool  ::=  main-menu + drawing-tool
     main-menu     ::=  graphics-submenu
                      | text-submenu
                      | paint-submenu

     graphics-submenu  ::= draw-circle | draw-line
             ::=  select-circle + choose-centre + choose-edge
     select-circle ::= position-mouse + CLICK-MOUSE
     choose-centre ::= position-mouse + CLICK-MOUSE
     choose-edge   ::= position-mouse + CLICK-MOUSE

             ::=  select-left   + choose-location + type-text
                | select-centre + choose-location + type-text
                | select-right  + choose-location + type-text
     select-left     ::=  position-mouse + CLICK-MOUSE
     select-centre   ::=  position-mouse + CLICK-MOUSE
     select-right    ::=  position-mouse + CLICK-MOUSE
     choose-location ::=  position-mouse + CLICK-MOUSE
     type-text       ::=  ENTER-KEY
                        | PRINTABLE-CHAR + type-text

Notice the different styles possible. In the graphics submenu, the option selection and the action selections are each packaged up into a named subdialog (draw-line and draw-circle). However, in the text submenu the top-level description of each option is included within the definition of text-submenu. With all notations, there is a similarly wide degree of stylistic choice. Suitably named subdialogs can make the entire dialog far easier to read, but, on the other hand, too many levels of abstraction can be confusing.

Also notice that the BNF description does not distinguish between selecting a menu option or choosing a point on the drawing surface. Both are described as position-mouse followed by CLICK-MOUSE. At the level of user movements and keystrokes, this is perfectly accurate, but loses the clearly perceived difference. This might be a good time to look at the UAN notation [165], which does distinguish these

Production rules

As the drawing tool is largely sequential, we would expect to find the production rule description rather cumbersome. The main problem is keeping track of how deep you are in the stack of menus, submenus and options. Watch out for solutions where the higher-level options are still active, when the lower-level dialogs are operating. For example, the top-level description might read:

     Sel-graphics    -->    <pop-up graphics menu>
     Sel-text        -->    <pop-up text menu>
     Sel-paint       -->    <pop-up paint menu>

This could exhibit strange behaviour. Imagine that the user is in the middle of drawing a line (using the first description in Section 12.3.1). Then after selecting the first point (at which point the system event 'rest-line' is active), the user goes back to the top-level menu and selects 'text'. At this point the text pop-up menu appears, and the user is able to start putting text annotations on the drawing area:

     Sel-left-just          -->  left-start
     C-point left-start     -->  left-type <typing cursor on>
     Type-line left-type    -->  <put text left justified> <typing cursor off>

The user selects left justified and goes to the drawing surface and clicks at a point. However, at this point there are two rules that can fire.

  • C-point left-start - from the text rules (above), setting the location for typing.
  • C-point rest-line - from the drawing rules in Section 16.4.2, putting another point on the line.

Whereas it is certainly the first of these that the user expects, the second is possible because the 'rest-line}' event is still active. Also looking back to the definitions in Section 16.4.2, we see that rubber banding would still be on during the entire text menu selection process.

There are various fixes for this. One way is to use 'clean up' rules as used in CCT in Section 12.2.2. For example, we would modify the top-level description so that it is not always active:

     Sel-graphics main-active
                   -->  graphics-active <pop-up graphics menu>
     Sel-text main-active
                   -->  text-active <pop-up text menu>
     Sel-paint main-active
                   -->  paint-active <pop-up paint menu>

The submenu options are then altered to update these activity events (the semantic actions have been omitted for clarity):

     Sel-line graphics-active     --> start-line
     C-point start-line           --> rest-line
     C-point rest-line            --> rest-line
     D-point rest-line            --> main-active

This now ensures that the user finished low-level dialogs before selecting new options at the top level.

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)

all exercises for this chapter