Both types are, however, only approximations. What is
probably worse, though, is that both only offer standard generic programming
languages to read, navigate, and output models.
While there are good programming languages for manipulating complex networks
of objects, and good programming languages for transforming one text stream into
another text stream, there are few if any generic programming languages well-suited
to navigating a complex network of objects and outputting text. Hence the need for the
languages and facilities speci?¬?cally designed for generation, which will be covered in
the rest of this section.
11.2.2 Model Visitors and Model-to-Model Transformations
The simplest kind of generator facility is a model visitor, which makes a mapping
from structures in the modeling language to structures in the output language.
Normally, each type in the modeling language is mapped to an output language
structure. For example, a graph type ???Watch Application??? may be mapped to a class,
an object type ???State??? may be mapped to a method, and another object type ???Time
Variable??? may be mapped to a ?¬?eld.
In some cases, the mapping is focused on the modeling language, with a fair
amount of freedom in what each type can map to. The generator visits each element in
the model, calling the generator for that element??™s type via the Visitor pattern.
Pages:
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499