Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Design

Domain-Specific Languages versus Generic Modeling Languages


DDJ: We are joined today by Steven Kelly, CTO of MetaCase, cofounder of the domain-specific modeling forum, and longtime contributor to Dr. Dobb's Journal. Steven, when do you think the benefits of domain-specific languages outweigh the advantages of using universally understood notations?

SK:First off, I don't think there's really such a thing as a universally understood notation. The "U" in UML stands for "Unified," not "Universal," and UML diagrams are certainly not understood by many customers. While most IT developers will recognize the core diagram types, they don't necessarily have the exact same understanding of them. And of course, there are plenty of procedural Perl or embedded C programmers for whom an object-oriented modeling language has never been relevant enough to learn.

Still, UML is great as a way for OO programmers to talk about code. It can be used whatever the problem domain: Whether you're building space shuttles, database applications, or games. The interesting thing is that discussions don't often make use of that lingua franca property -- the game developers talk to other game developers, and to customers for the games. For that purpose, they already have a shared language, which is the vocabulary and terms of the problem domain.

A domain-specific language crystallizes that shared vocabulary, along with the rules of what information must be recorded about each element, and how the elements can be connected. This gives developers and customers a precise, high-level, shared language for discussing, thinking about, and designing applications. The tight fit with the problem domain, high level of abstraction, precision, and ability to use with customers are clear areas where DSLs excel over generic languages like UML.

An experienced developer in that domain can build a working application directly from these high-level specifications. More importantly, it's normally possible for an expert developer to specify how an application should be built from such specifications in general. In other words, the expert developer can specify what each element and structure in the modeling language maps to in the programming language and frameworks in use. Rather than write an in-house style guide in Word, the expert can specify these mappings as a code generator. Now, any model built with the modeling language can be turned into code automatically. Unlike previous code generators, provided by external tool vendors with no idea of your problem domain or code, this one is written by your own expert developer to produce the kind of code he would write by hand.

DDJ: And this naturally has an impact on productivity?

SK: Industrial cases of domain-specific modeling languages and generators consistently show productivity increasing by a factor of between 5 and 10. The question then is: "How much effort is it to build your own modeling language and generator, and how many times will you use it?" If you are working in the same problem domain on a regular basis, the payback is all but certain: Researchers and practitioners like Lucent's David Weiss generally find the break-even point is at around three applications or features in the same domain. Note the mention of "features" there. Even if you are only building one product, that product may contain many parts that can all be expressed with the same modeling language.

DDJ: Are the two approaches in competition or can they coexist?

SK: Domain-Specific Languages have been around a lot longer than UML -- just look at things like LabView and SQL. People have been creating their own in-house textual DSLs since the dawn of the computer industry, and I can't see that stopping. In any given domain, a good Domain-Specific Language will always beat a generic language: horses for courses.

Creating in-house graphical modeling languages is something rather newer. There is a lot more work involved in supporting graphical modeling compared to textual editing. Building your own graphical modeling tool has only been realistically possible since the 1990s, when the first metaCASE tools were released. Tools like our own MetaEdit+, and the recently released Microsoft DSL Tools and Eclipse EMF/GMF, automate all or most of the graphical modeling support.

Even with the best domain-specific modeling language and tool, however, there will always be things that lie outside its domain. For those areas, we will still need traditional programming and generic modeling languages. Similarly, for areas where a particular application is a one-off from the point of view of a given company -- unless there is an off-the-shelf tool that supports it, most likely, it will be built with traditional techniques.

DDJ: Where do you see the "conflict" heading in the future?

SK:The situation is rather like the move from assembly language to third generation languages: Nowadays, most people never have to touch an assembler and can do all their work at a higher level of abstraction. To make that possible, there must still be people building the lower levels, and certain parts of a project may need to drop down to a lower level for a critical optimization or hardware interface.

The key factor pushing people towards domain-specific solutions is the increase in productivity, with quality and communication with customers also important concerns. As most of the productivity increase comes from the code generation, and a generic or "universal" modeling language cannot offer that, we will see an increasing move to domain-specific solutions. Hopefully, most of the move will be made by lead developers seeing this is the right way to go, rather than managers pouncing on the latest buzzword. And conversely, let's hope that those developers who decide to wait have equally good reasons, not just "bah, humbug!"

An interesting question is how much we will see modeling languages for broad domains such as "any web application," and how much for in-house domains. The greatest productivity increases come from the latter, because the language can be made to precisely fit the needs of just one company. More importantly, the company is in control of the language and generators, so they can evolve as the problem domain evolves. In today's fast-changing world, that may prove to be the decisive factor.

Editor's Note: For more information on domain-specific languages, refer to the Code Generation 2007 conference at Homerton College in Cambridge, UK. A panel discussion moderated by Andrew Watson of OMG, features Juha-Pekka Tolyanen from Metacase, Steven Cook from Microsoft, Tony Clark from Xactium, Matthew Fowler from NT/e, and Chris Raistric from Kennedy Carter.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.