SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 599 | Next

Steven Kelly and Juha-Pekka Tolvanen

"Domain-Specific Modeling"

Such parts
can also appear in the generator as a larger structure of code that remains the same for
all applications, with short one or two line segments of boilerplate interspersed with
the details ?¬?lled in by the model.
For instance, in the switch??“case pattern described in Section 11.3.6 there is a clear
pattern of two nested layers of switch??“case statements to implement a state machine.
The structure always remains the same, with the models simply providing different
states, events, actions, and transitions. This was also the approach used in the C
generator in the Watch example in Chapter 9. To invert control, the underlying
structure of the switch statements??”see what state we are in and what event occurred,
then do the requested action and follow the transition to a new state??”is moved out of
the generator into the domain framework. The generator simply supplies the
de?¬?nitions of the states, events, and transitions as data, and probably implements the
actions as new functions. The framework runs its generic state machine over the data
supplied by the generator, calling the generated action functions where necessary.
This is the approach seen in the Java generator in the Watch example.
12.3.5 Engines Reading Models as Data
We can also take inversion of control further, to the pointwhere the framework becomes
an engine.


Pages:
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6