Many objects exit on a simple ???done my stuff,
time to move on??? basis. These decisions are thus dependent on the object type and tend
to be based on the internal state of the program.
In contrast, state machines have a global concept of what can trigger a transition
from one state to another. Typically this is an external event, although it can also be
an event caused internally. States thus operate on a more laid back ???done my stuff,
nowI??™ll just hang around here??? basis, waiting for something to kick them out of their
reverie. While states thus lead a more relaxed life than ?¬‚ow machines, not
everything is easier.Whereas in a ?¬‚owmachine each object could decide itselfwhen
it was done, and where to go next, in a hierarchical state machine an event in a toplevel
model can cause us to jump up out of a state in a lower-level model, even
though that state speci?¬?ed nothing about the event. When the man at the top says
jump, you jump.
Actions in a state machine are most often speci?¬?ed along transitions, although they
can also be speci?¬?ed in a state, for execution on entering or leaving that state. In a
DSM language, some features of a state can be speci?¬?ed as properties of the state, as
opposed to actions. Recall in the Watch example, each state speci?¬?ed whether a
certain time unit was ?¬‚ashing while we were in that state, and which display function
292 GENERATOR DEFINITION
to use while we were in that state.
Pages:
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543