The Hidden Costs of Domain-Specific Languages
Wednesday, November 25th, 2009While I am a big fan of Domain-Specific Modeling, I am openly not in favor of Domain-Specific Languages. DSL supporters advocate many good things. Are they real? Is it the whole truth?
Let’s see some good (valid) points about DSL’s:
- It’s domain-specific (duh!)
- Encapsulates boring details
- Can increase abstraction to the next level
And other not so valid points:
- It’s a Shiny New [mainstream] Thing. Most developers love that
- It’s cool and I can do it too
The first are very enticing, valuable, and sought for, and most of DSL’s attraction I guess comes from these features. But, will it pay off?
I really don’t have much experience with DSLs, so I won’t use my own arguments. I’ll let the community speak for myself. Here is a tiny sample of DSL criticism:
http://c2.com/cgi/wiki?DomainSpecificLanguage
… the Tower Of Babel effect that results from having so many languages that a person needs to be familiar with (if not master) in order to get common jobs done.
…
writing a good DSL that is robust and reusable beyond a limited context, is a lot of work. It requires persons with both domain expertise and language design expertise (not necessarily the same person) to pull off. A truly reusable DSL will require reasonable documentation, otherwise it won’t survive the departure of its designers.
http://www.theserverside.com/news/thread.tss?thread_id=42078
The other mistake some folks make is they think that with a DSL that “non-coders” can actually use the DSL.
But since a DSL is designed for automation of an underlying objet model, writing in a DSL is just like writing in any language — whether it’s DOS .BAT files or Java, and it takes a coding mindset and understanding of the underlying domain as represented by the computer in order to make effective use.
There was much more written on this thread. You can go to the original page to read more opinions.
As general use of DSLs become mainstream, so become the complaints about their shortcomings. If we take so much time to master a general purpose language, should we invest a comparable amount of time in limited-use languages? How can we get support for a DSL, apart from its own creators? Where’s community support? What happens after the departure of the language’s creator? What’s BNF? Do I need it?
DSL critics say really useful DSLs are hard and expensive to create. DSL supporters answer that DSLs are not designed, they evolve. Well, won’t any of those “evolutionary steps” risk breaking the entire development based on that DSL, much like a broken app build? Will the evolution in the language be severe enough to trash what has been done so far? Can you imagine yourself developing a complex C++ software system while C++ itself was still being designed and developed?
Still too many unanswered questions.

