UML vs Domain-Specific Languages

Great minds think and do not always think alike. In surfing the web this week around clojure, Stack Overflow, Architecture and DSL (Domain-Specific Language) sites there is just a broad misunderstanding of UML. Really smart people seem to miss that UML is more than a modeling language with everything and the kitchen sink that is to vague to use. Just keep reading...really.

UML is meant for extension and restriction as it offers, via the UML Profiles, mechanism which I recently extolled in Profiles - The UML problem solver. I have found others that are in this camp, http://www.dsmforum.org/. They even wrote a paper UML vs. Domain-Specific Languages, Methods and Tools which if you go by the title seems to pit UML against DSLs, however it is quite the opposite. They seem to understand that UML profiles can be used to create restricted models or DSMs (Domain Specific Modeling); and yes I am using DSM and DSL interchangeably. Call me crazy, but this is also what the OMG - Object Management Group(www.omg.org) thinks who created UML. They just like to call DSLs and DSMs by MDA (Model Driven Architecture), UML Profiles, Meta-Modeling. I hope to post just on the book OMG book "MDA Distilled" by Stephen J. Mellor soon as it really helps you understand the whole modeling thing in the context of UML, but any how. There seems to be more of a PR problem than feature problem. It does not help that schools don't teach functional languages let alone modeling languages.

Additionally people equate the UML primitive "class" with Java classes so they infer that UML must then be object oriented, which it is, but objects can be anything really such as functions, you just need to specify. So, UML can model functions as classes, yup, it's called stereotyping. People seem to think stereotyping is some fancy <<Comment>>, which is how they use it, never knowing that they are on the verge of using UML profiles. All they would have to do is formalize the <<Stereotype>> in the UML profile and then apply it to their model. Take modeling a lisp function. Just create a stereotype <<function>> in your UML profile and then constrict it using a constraint language such as OCL (Object Constraint Language):
1. Constrain all classes to be functions, that way I can only model functions.
2. Constrain that by stereotyped classes cannot have methods, as they don't make sense in the context of functions.
3. Constrain all parameters/attributes to only be other functions or primitives (like lists), functions, or numbers.
4. Constrain your function stereotype to only "use" other functions, not extend, realize, or other object stuff.
...and so on.
The point here is not complete nor would it help you stay awake to be, the point is remember that <<stereotype>>s are so much more than comments; UML has comments which are called notes.

Not yet on board. Fine, but take a look at how others are creating DSLs and DSMs with UML. You just need to speak UML acronym soup:
*UML Profiles - Implemented in many UML tools.
*Rational (RAS) Re-usable Assets - A pattern as a profile.
*RSA Plug-ins (Deployable profiles)
*MDA - Model Driven Architecture
*MOF - Really not UML, but what UML is defined in.
Some notable examples:
*UML 2.0 Profile for Software Services
*OMG - UML Profile Specifications
Further Reading:
UML vs. Domain-Specific Languages

Comments

Popular posts from this blog

Configuring Javascript SyntaxHighligher 3+ in a Blogger site

Reference Cards, Cheat Sheets, Posters, whatever they are called.

UML supports the MDD process: No match made in heaven or oxymoron.