O'Reilly logo

Domain Specific Languages by Martin Fowler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required