Chapter 56. Model Ignorant Generation

Hardcode all logic into the generated code so that there’s no explicit representation of the Semantic Model.

image

56.1 How It Works

One of the advantages of code generation is that it allows you to produce code that would be too repetitive to write by hand in a controlled way. This opens up implementation options that, usually, you would wisely shy away from because of duplicating code. In particular, this allows you to take behavior usually represented through data structures and encode them in control flow.

To use Model Ignorant Generation, I can start by writing an implementation of a particular DSL script ...

Get Domain Specific Languages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.