This chapter covers
- Understanding domain-specific languages (DSLs)
- Writing DSLs in Groovy
- Creating readable and expressive languages
- Testing, securing, and providing good error reporting when creating DSLs
The limits of my language are the limits of my world.
Ludwig Wittgenstein
Domain-specific languages are languages tailored toward representing a particular domain of knowledge. Proponents of development methodologies suggest that what leads to success or failure of a project is the quality of communication and a common goal of producing software that delivers on promises of solving a particular domain problem.
Languages are at the root of any kind of communication and involve two interlocutors. A subject matter expert (SME) can write specifications in their mother tongue, say, English, with tons of domain-specific words and concept names that will be read by software developers. A developer can also speak to a computer using different languages to tell it about the business rules of the application the SME is longing to play with. The former will use a natural language while the latter will use one or several general-purpose programming languages.