This chapter covers:
- How the build system relates to the Domain IDE and the Runtime
- Why make a reference implementation of the Runtime first
- Implementing a code generator using templates
- Deriving templates iteratively from the reference implementation’s code
- Composing templates conveniently, with declarative indentation
In the previous chapters we started working on a Domain IDE for the domain experts to capture their business knowledge with in the form of DSL content. We said in chapter 1 that this DSL content should not just be “pretty pictures” or mere documentation, but should be precise enough to build software from. In this chapter, we’re going to do exactly that: generate a Runtime from DSL content written using the Domain IDE.
Figure 8.1. Using a DSL-based approach to develop a Runtime using a Domain IDE.
Our example DSL and its example content captures how to compute a rental price based on what data input by business stakeholders. The Runtime for this DSL content could be as simple as a Web app that displays a form in which business stakeholders input data about a rental.
Let’s have a better look at the Runtime, in particular at how its codebase is organized in general.
Figure 8.2. The organization of the Runtime’s codebase.
The Runtime’s codebase can be divided into the following parts: