Jolt Finalist: Domain-Specific Languages, by Martin Fowler with Rebecca Parsons
Martin Fowler's Domain Specific Languages is a big book. Weighing in at over 600 pages, this book attempts to cover the broad field of domain specific languages (DSLs). Unlike other books that attempt to cover a broad field, there is a lot of code in this book.
DSLs receive considerable coverage today as an approach to bring computing closer to users. A DSL is a specialized language where someone familiar with a particular domain, or area of expertise, can create software by expressing computation using familiar terms. If you are new to DSLs or want to understand the mechanics of how to implement your own DSL this book is for you.
Fowler makes liberal use of examples to illustrate deep concepts. He organizes the book into six parts beginning with a survey of the DSL neighborhood and then proceeds into the technical details. A reader who wants to understand what a DSL is and what it is good for need only read part I to gain a conversational knowledge of DSLs. His example in the first chapter of a Gothic security system is entertaining and informative and sets the stage for the rest of the book. Part I leads the reader on a journey through DSL land that winds through different types of DSLs, alternatives to DSLs, and some engineering details on how to implement DSLs.
Fowler divides DSLs into two categories: internal and external. External DSLs use a programming language to create a different executable language. Internal DSLs use stylistic variants of a programming language to make it easier to create executable programs in that language. Three parts follow, containing the basic patterns one should understand when constructing either type of DSL. After Part I, the reader should understand the basics of how to create a DSL. However, the devil is in the details. These three sections provide those details. Fowler presents the details as patterns, with each chapter illustrating a single pattern.
Part II provides patterns needed for any type of DSL, including the all-important Semantic Model. Parts III and IV offer the patterns needed to construct external and internal DSLs. Readers familiar with language translation technology such as compilers will feel at home in Part III that focuses on external DSLs. External DSLs require more core computer science knowledge, such as parsing theory. Someone without an understanding of compilers should probably skip Part III on first reading.
The book does not use one specific language for its examples. In fact, Fowler uses common languages like Java, Ruby, and C# as well is widely available tools such as the ANTLR parser generators. Many readers will learn something about languages and tools that they have not experienced before as a side effect of reading this book.
The final parts of the book are relatively short. Part V presents alternative computational models, such as decision tables, production rule systems, and other models that into the DSL space. Part VI covers code generation. One might skip these two parts on the first reading.
This book omits details about engineering a DSL. If you want to understand how to organize a project and determine the process needed to engineer a DSL, you should refer to the ample body of software reuse literature. Domain Specific Languages does not address these issues, nor is that Fowler's intent. He is focusing on the nitty-gritty decisions and details and there are plenty of them that will help the software developer produce a robust DSL. If you are such a developer, get this book. Read it lightly at first and then refer to it often.