Over a million developers have joined DZone.

What Are Good Books on Best Practices of the Design of Domain-Specific Languages?

Domain Specific Languages are a great tool for building clean understandable code. Here we have the best resources available to help you discover best practices.

· Java Zone

Learn more about the advantages of moving from a monolithic to microservices architecture.  Brought to you in partnership with IBM.

Recently I answered this question on quora. I thought it could be useful to report the answer here, in case someone else is looking for books about Domain Specific Languages.

On one side you have internal DSLs: they are sort of fluent interfaces written typically in flexible languages like Ruby. You create functions, classes and metaprogramming tricks to let the programmer specify the logic in something that resembles a specific language but is actually just regular code (Ruby for example).

Then you have external DSLs: they are regular languages with their tooling. You can have parsers, editors, code generators or interpreters and other stuff.

External DSLs are the real stuff, internal DSLs are nice but really nothing game changing.

  1. On external DSLs I strongly suggest you to read the book from Markus Völter, DSL Engineering. Markus is a very well known consultant doing real stuff.  This is a book about external DSLs, with practical pieces of advice, comparing several language workbenches. He talks about very different approaches to DSLs and he has unique hands-on experience. Simply put, he is probably the best world expert on DSLs.
  2. If you want to get started with one specific Language Workbench you can read the book from Lorenzo Bettini: Implementing Domain-Specific Languages with Xtext and Xtend. It will teach you how to write DSLs using Xtext. Xtext is a mature Language Workbench for writing textual DSLs. It is a very reasonable choice and when you have finished this book you will have some real competence in writing DSLs.
  3. If you are more interested in something more high-level and more focused on internal DSLs you can take a look at Domain Specific Languages from Martin Fowler. He is a well-known opinion leader and a great speaker, so it could make sense to listen to what he has to say.
  4. As an alternative, you can look to DSLs in Action (I was one of the technical reviewer for this book). It is nice to read but also this one is focused mostly on internal DSLs.
  5. If you are not interested in building great editors for your language or you want to have a fully customized solution for your textual language you can consider looking into ANTLR. It is “just” a parser generator, so it does not provide full tool support like Xtext or MPS but it is a well-known tool and the book Language Implementation Patterns describe how to use it in practice. The author introduces patterns which are useful in general.

From Idea to Application gives you the architecture to quickly build, manage and run a range of applications (web, mobile, big data, new smart devices, etc.) on an open-standard, cloud-based platform. See why developers are using IBM Bluemix. Brought to you in partnership with IBM.


Published at DZone with permission of Federico Tomassetti, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}