>So..every few years it seems we have to come up with a new HOT or Cool buzzword in the tech community. It seems that DSL is now that term. For those that have been hiding underneath a rock for the last year, DSL = Domain Specific Language. Think of this as a custom programming language designed to handle a very specific task. Wikipedia has a decent definition. DSLs aren’t knew, they’ve been around since the age of 1s and 0s.
We in the programming world seem to invent new DSLs everytime we touch the keyboard. Existing items aren’t good enough or may be too wordy. DSLs give me cramps. I think in many cases they are over used and for the wrong reasons. Now that isn’t to say that I don’t think there is a need for them, when they are done for the right reasons. However, it seems that everybody’s answer to a problem now is to create a DSL.
The problem with DSLs is that it’s yet another language one has to learn to maintain software. My head is already cramped full of various utility languages and I’m sure it will be cramped with some more over time, but many of these languages don’t provide the convience that they try to provide. Ask yourself before coming up with another language:
- Is there a currently supported standard that works?
- Can I extend this existing standard DSL?
- If not, why not?
- Will creating yet another DSL really solve the problem and make it easier to maintain going forward.
I work with XML which itself is a DSL for creating other Markup Languages, and its simplicity of implementation and power has also been its bane as well. XML is over used in many situations because it is too convient to use. With this said, there are a hand full of programming DSLs with in the XML world. Some are better than others, and several are starting to evolve into general purpose languages in their own right. Some examples.
- XSLT – functional language used for transformations. Comes in two flavors XSLT 1.0 and XSLT 2.0. It itself is written using XML.
- XPath 1.0 and XPath 2.0 – A DSL for querying information from a XML Tree, usually a DOM.
- XML Schema – a DSL for describing XML Validation. Written using XML.
- RelaxNG – Another DSL for describing XML Validation and content. Comes in both an XML based syntax and a Human Readable Compact Syntax.
- XPointer – a XML DSL for specifying the location of information with a document.
- XInclude – a XML DSL for specifying how to include or import information into existing XML documents.
- Web Services – A whole family of DSLs describing how to create web service implementations.
- SchemaTron – Yet another XML Validation DSL for validating XML files.
XML has made creating a DSL very simple and straight forward. It however is often used for the wrong reasons.
Which brings me to XText. I’ve been experimenting with it for a couple of days, and like XML it provides great power at little upfront cost. However, I also think like XML it can run into being applied way to often just because it is easy to create and deploy. XText itself has it’s own DSL for describing the languages, however, I wish it would have just leveraged an existing established standard language like the ISO EBNF.
So how many more DSLs will we create? More than we really need.