Welcome to MSDN Blogs Sign in | Join | Help

Why not base domain specific languages on UML?

RobR writes:

re: DSL tools available
I'd be interested to know how your tools differ from doing the following:

- creating a bunch of stereotypes in a UML tool (possibly with some icons to make it look prettier). So for baggage handling I could build various domain specific stereotypes: conveyor belts, etc.
- define some code mappings into a target language that generate code for specific stereotype instances
- start modelling!


 

Thanks Rob, this really is the $6.4e4 question!  (Well, one of them.)  Main thing is that it’s a lot simpler if you don’t bother with UML for this purpose: less for everyone to understand, fewer constraints, less clutter in the tools and language; set against no real drawbacks (when you think about it).  Here’s the long answer:

 

UML great for other things.

Firstly, just to reiterate – we do believe in UML’s usefulness for a variety of tasks. I sketch in UML for analysis purposes and for helping to think about the detailed design of code; I’ve written a book about it, developed some nice techniques, and given numerous courses over the years, and signing up with MS hasn’t changed my views; and my group colleagues have comparable histories, some of them making substantial contributions to where UML is today. Furthermore, I’ve happily used a variety of specialist tools that use UML as a view of code or configuration files. But we do think that when it comes to composing software product lines, UML is not the best answer. After all, there are no panaceas, and one language can’t be expected to do everything.

 

UML too limited for DSLs.

So here’s why we don’t want to limit ourselves to UML as a basis for our users’ domain-specific languages:

  • A careful look at the specialization mechanisms for UML reveals their limitations.
    • Stereotypes and tagged values allow you to change icons etc, although even simple alterations like decorating a box to show the state of some property isn’t within range. You can’t change the semantic constraints, or invent new sorts of diagram or new categories of element.
    • You can’t take stuff away, so your users are always distracted by other options and elements and diagrams that aren’t relevant to your language.  Tools that use a UML editor as a front-end have to have a (very annoying) validation step before they generate their DB schema or whatever it is.
    • Many of the current crop of tools don’t handle them very well anyway; let’s hope that will change.
  • UML only includes certain types of graphical format – if you want your language to include tree-structured diagrams, or tables, or math formulae, or block-structured text, or prose, or if you want hyperlinks – well, I think you’d have a hard time. While our initial offering won’t include all those styles, we’d certainly like to support them at some stage in the future.
  • An important aspect of the definition of a modern language includes how you interact with it: how you navigate and elide or elaborate and edit etc – think of your favorite GUI composing tool, in which the GUI-defining language is scarcely separable from its editor. You can’t do anything about these aspects in UML.
  • What you get out the back of one of our tools says things like <CheckinDesk> and <ConveyorBelt>. What you get out the back of a UML tool says things like <Class> and <Stereotype> -- much more difficult to read. (Yes, of course you could write translators, but it’s an extra layer of hassle.)
  • You have to understand all of UML (stereotypes etc) before you can create your language on top of it.
  • Your users have to understand an editor that’s intended for something far more complex than they probably have in hand – or at least whose complexities are in a different direction.

 

No real drawback to not using UML.

What might users lose by not basing their DSLs on UML?  Interoperability with other tools? Well actually, basing your DSL atop any intermediate language makes things worse! Let’s think about a scenario:

 

  • My baggage-handling-software company uses kit from International Business Software, yours uses MicroMachines. One day we get a joint contract, and so we want to swap designs between us. But oops – our languages are similar, but different: ours includes stuff about the colour of the checkin desks, because we’re kinda artistic, while yours is strong on the number of nuts and bolts in each one. So what do we do? Well, we’ll have to (a) make some sort of translator; (b) persuade our editors to deal kindly with the lack or superfluity of colour or nut-count information in documents originating with the other group. 

    Now notice that this problem has nothing to do with the brand of kit we’re using. If we both had IBS or MM kit, or both kits were UML-based with interchange in XMI, we’d still have exactly the same problem: the difference arises because we’ve each generated our own different language. What’s more, each of us wanted to be separate, because our own language is an essential part of our competitive edge: it would have to be a really good contract, to persuade us to interoperate in this way. 

    What we do want from our kit, is that our generated DSL-processing tools must to be tolerant of variations – which they’ll have to be anyway, to cope with inevitable changes in our languages. And we want some tools that help us build translators – necessary for the same reasons.

 

  • Actually the problem’s worse if you do it all on top of UML: even if we’re agreed about the set of concepts we’re modelling, we might disagree about whether a ConveyorBelt should be a class or an association or an actor or …. There’s an extra layer of redirection that introduces a spurious source of variability.

 

So on the whole, I think interoperability of the generating kit is a red herring in the area of DSLs.

 

Domain-Specific Languages are just part of the Software Factory approach.

Finally, for a bit of perspective: the domain-specific language itself is only part of the story. The surrounding process and tools, we call the Software Factory – the vision is defined in the Greenfield and Short book recently out, and at http://msdn.microsoft.com/architecture/overview/softwarefactories/ . When you use any kind of software product line, you need to change your process: for example, to evolve the language and the framework that interprets or executes it. That framework will typically be a very substantial body of software – usually evolved from pre-DSL specific instances. For example, you might take the software you wrote for LAX and combine it with a few bits from the Heathrow job, add some parameters, and smarten up the separation of concerns.  (Again, it will embody all the expertise that gives your enterprise its competitive edge, so you won’t be thinking of sharing it with anyone.)  This effort is the most substantial part of your adoption of software factories, and we aim to cover these other aspects with our tools.

 

 

So (1) we think sticking to UML would limit what our users can do; (2) no-one loses anything by not using UML in this particular area; (3) designing the language is not the biggest part of the job.

 

Alan

Published Thursday, November 11, 2004 7:17 PM by Alan Cameron Wills

Comments

# New Team System Stuff - 2004-11-11

Friday, November 12, 2004 4:33 AM by Rob Caron's Blog

# re: Why not base domain specific languages on UML?

Thanks Alan,

I think for many language definition purposes, UML stereotypes are in fact much more useful than you think. In effect, they are extending the UML metamodel, and many UML tools these days provide reasonable access to scripting languages for both checking that they are used consistently and for generating code. So you can actively say "prevent the designer from connecting a conveyor belt to an airport lounge" or "don't use UML abstractions". The other advantage is that UML stereotypes are easy to use (remember that many users are not all language design gurus) yet they want the ability to quickly create new design abstractions that extend their tools' capabilities.

I'd also like to raise another issue regarding UML, which is actually quite important when you do language definition for real: you don't mention language design scenarios where you actually want to incorporate new abstractions within your pallete of existing UML abstractions. This happens all the time. Let's say I want to add the notion of a Component to UML. I certainly don't want to have to build a DSL tool for all of UML - yet my designers are conversant in UML and I want to maintain that knowledge. So really you *need* UML to make this all fly. Now, of course MS or its partners may be deciding to implement all of standard UML 2.0 in the technology ;)

A few more comments:

1. Tools built on the type of meta-technology you talk about are not new. Here are just a few: DOME, MetaEdit+, Xactium-XMF, EMF, DSTC's tool and Vanderbilt's tool. Much of what you are talking about as the big vision has already been done - today I can download free tools that help me create visual editors and transformation engines, all of which instantiate an underlying metamodel expressed in a common metamodelling language (usually MOF).

2. As you say, just dealing with the visual aspects of languages is not enough. Although you mention the GUI aspect of a language, there is surely something missing in that diagrams only capture half the story. Such visual only languages lack power (and are therefore of limited usefulness) because they cannot express the detail - that's where textual languages, like programming languages and expressions languages are so essential. I simply don't believe that you can generate real systems from visual representations without the visual representation becoming hugely complicated.

This is again where standard expression languages like OCL and ASL can fit in - enriching models so that they can capture the detail. Alternatively, something like a grammar modelling language (Xactium's XBNF grammar is something I recently came across - which captures a textual representation of a language as a mapping from a grammar to a MOF metamodel) would appear to be a very important part of what you need to do to model complete DSL tools.

3. When using a textual DSL, you then have to consider the needs of end users: will they be able to learn it? If you choose a non-standard langfuage you have a big training overhead. Will they be able to debug it, parse it, interpret and compile it? You might be interested in looking at work being done by Jeff Gray on the subject of extending the Eclipse debugger to support DSL's.

4. Finally, MDA has made some important strides towards developing the *standards* necessary to support DSL's: MOF is a central plank for enabling interchange of metamodels. QVT is a language for expressing model to model transformations. Diagram interchange is a standard for capturing models of diagrams. Is a MOF and QVT like language something that you at Microsoft will be supporting, and if so, do you see it becoming a way of exporting the designs of all your languages and mappings into the community, or is the intention to keep things under the bonnet? I also notice that although you mention the word "metamodel" - the * meta language* you do this in does not appear to be a central plank of the technology. Yet, to those who develop such tools, it is the foundation of everything and the means of achieving open and transparent interchange of models and metamodels.

Saturday, November 13, 2004 12:13 PM by RobR

# Language-oriented or Metadata-driven?

Tuesday, November 30, 2004 3:14 PM by GarethJ's WebLog

# UML Semantics

Wednesday, December 08, 2004 4:01 PM by Steve Cook's WebLog

# re: Why not base domain specific languages on UML?

This DSL wave reminds me of work I did in a previous lifetime, although then we called it visual programming. I built the initial versions of a product used to specify simulations graphically. The product still exists http://www.cae.com/www2004/Products_and_Services/Power_Systems_and_Simulation/Technology/rose.shtml

Anyway, we spent a lot of time thinking about visual representations of software. it turned out that the times we were successful was when the system in question *already* had a visual representaion. Examples are piping and instrumentation diagrams, electronic schematic diagrams, ladder logic diagrams, etc.

In those cases where we tried to create new visual representations we failed. The "business users" invariably rejected our attempts to turn their knowledge into diagrams because they were unnatural to experts in the field. The fact that they had not yet created such diagrams was a telling sign that no such representation was possible. Those fields where such representations were useful had long ago created them.

Software people make the mistake of thinking that since they use UML to describe their software, and software can represent anything that they should use UML to represent anything. But in fact I find that UML is a lousy way to represent code at a level detailed enough to execute. A much better representation is high level source code. It's compact, expressive, and the result of generations of refinement - just like schematics and P&IDs.

Now don't get me wrong. I still think DSLs are a hoot. But they should be at a level of abstraction well above source code, and still contain enough information to be executable. This means that they should represent "business" entities, not software entities. Just as a schematic allows you you completely specify a circuit in terms of resistors, capacitors etc a banking DSL should allow you to completely specify a bank in terms of customers, accounts and processes. But the way to arrive at such a language is to go ask bankers if they have a typical way that they draw pictures on a whiteboard when they descibe their business, and then copy that. And I bet they don't use UML!
Thursday, December 09, 2004 3:49 PM by Lloyd Fischer

# Domain Specific Languages (DSL)

Friday, December 10, 2004 4:21 AM by Khurram Aziz

# Booch on DSLs (Round 3)

Friday, December 10, 2004 5:50 PM by Harry Pierson's DevHawk Weblog

# The Pharonic Architect is Blogging

Monday, December 20, 2004 10:50 PM by Harry Pierson's DevHawk Weblog

# Back and Forth on UML and DSLs

Wednesday, January 05, 2005 12:38 AM by Don Box's Spoutlet

# Should DSL use UML

Wednesday, January 05, 2005 3:27 PM by Bruce Johnson's SOA(P) Box

# Software architecture, software engineering, and Renaissance Jazz

Ping Back来自:blog.csdn.net
Thursday, February 03, 2005 3:00 AM by 登陆楼顶听月--楼顶主人

# ??????????????? &raquo; ???????????? &raquo; UML???DSL?????????

Saturday, March 29, 2008 1:03 PM by ??????????????? » ???????????? » UML???DSL?????????
New Comments to this post are disabled
 
Page view tracker