Larger generators should be broken down as necessary into subgenerators for each
modeling language, ?¬?le type to be generated, and model element type. Repeated
sections in generators should be refactored into subgenerators, just as with any
program.
In many ways, the process of building generators is just a case of applying
the generic parts of best programming practice. A generator takes a certain kind of
input, normally an object structure, and processes it to produce a certain kind of
output, normally one or many text streams. Only when the input and output
formats are known, and an example of each is available, can generator construction
sensibly begin.
SUMMARY 309
The close coupling with the input format means the generators should be
distributed and versioned with the modeling language. It is also good practice to have
the generator annotate the output with version information about the models,
modeling elements, and generator itself. While a good DSM tool will make most
versioning issues invisible, having the information there may one day solve that
mysterious ???but it worked yesterday!??? problem.
310 GENERATOR DEFINITION
CHAPTER 12
DOMAIN FRAMEWORK
Domain Speci?¬?c Modeling (DSM) is only one of a number of ways of improving
developer productivity in a given domain. Like many of these ways, it takes advantage
of some kind of repetition in applications built for that domain.
Pages:
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581