. .
The Time application is also an example of a possible type of reuse that has not
been implemented in this modeling language. There is clearly something similar in
the States, Buttons, Transitions, and Actions for EditHours, EditMinutes, and
EditSeconds. Each Edit State selects one time unit of the same timeVariable, and the
Up and Down Buttons roll this time unit up and down. A similar pattern is seen in
FIGURE 9.8 Reuse in the Time application
210 DIGITAL WRISTWATCH
other applications where a time variable is being set by the user, that is, Alarm and
Timer. There, however, only the hours and minutes are being set, and there are
differences between the three cases as to the Display Function used. Because of
these differences, it was not possible to build a subapplication that each of these
three applications could use.
We did, however, consider a new modeling language concept, TimeEditor, which
would have stood for a set of related states like this.ATimeEditor instance would have
speci?¬?ed the variable to be edited, the ?¬?rst and last time units to be edited, and the
Display Function to be used. This information would have been suf?¬?cient to cover the
variability between the three cases, and we could have built a domain framework
function to handle the behavior, and made the generator create a simple call to that
function.
Pages:
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390