« UML vs. DSLs | Main | Sony Ericsson P910 »

07.01.05

UML, OOAD and MDD

In addition to my previous entry, I’d like to comment on Jack Greenfield’s view of UML and it’s shortcomings in the field of Model-Driven-Development (MDD). Jack describes UML as a useful means of object oriented analysis and design here and here. He says that UML is not the appropriate tool for MDD and that it’s “focus is primarily on creating documentation that describes system structure or behavior.”.

My question is, what are analysis and design all about in Jack’s view? In my opinion software development is a series of model transformations. Parts of this transformation process can be automated and some parts have to be manually transformed. What are models anyway? Models are an individual’s view of real objects or processes. In order to cope with the complexity of reality models reduce the sum of aspects to those which are relevant for the context at hand.

The first model which comes to our mind is the natural language, at least I hope every developer’s brain works that way (funny, imagining Jack or Grady thinking in DSLs or UML diagrams ;-)). That’s what I would call analysis. Some parts of the design model may also be described in a natural language. Thus analysis and design are about creating models, aren’t they. Granted, these models are also suitable for documentation purposes.

The next step in the process is transforming your natural language model into a UML diagram (or a DSL). Why should I do this? Just write down your analysis requirements into plain code. We might argue about that, but I think that’s out of the scope of this blog entry … To answer the question: Model transformations are a way of reducing complexity and thereby formalizing models and at the same time loosing information. By formalizing we manage to remove ambiguities which is important for developing a consistent software. But we also lose information. This information might be added by for instance OCL constraints or other formalisms. I think that they are better gathered and manually added later on in the development/transformation process.

Additional transformation steps may be added before generating or manually implementing code. For instance an analysis model is transformed/formalized by a design model.

The last noteworthy step is to generate code from your (UML / DSL) models and fill in the missing information by manually implementing business rules which would have been much to difficult or even impossible to express in the UML notation, i.e. OCL. Your code is then transformed into byte code, and eventually into a sequence of 1000101001001 …

O.K. but UML still is not suitable for MDD, but DSLs are! First, I hope that I managed to explain why UML diagrams are models which may be transformed into code (-> MDD) and not a mere means of documentation. Simply put analysis and design contribute to implementing a software system as well as documenting the system! What is the difference between UML and DSLs? UML as pointed out in many other blog entries, e.g. by Stefan here, is a flexible instance of MOF which can be used in great variety of contexts. In addition UML can be customized by UML profiles (stereotypes). The advantage of customizing UML in contrast to specifying a new instance of MOF is that many aspects of UML can be reused and don’t need to be defined again and again. It might also be easier to get used to different UML profiles, all based on UML, than to familiarize with totally different DSLs. In the end it depends on the user. Some may prefer a more flexible meta model, which lacks some specific traits of the domain, others want to use a model which is as close to the domain as possible.

Posted by Hartmut Wilms at 07.01.05 18:15