Click here to Skip to main content
Click here to Skip to main content

MDD = Model-Driven Drama

By , 12 Jul 2011
Rate this:
Please Sign up or sign in to vote.


There is new trend towards using models as a strong basis for software development. This approach is intended to become the next generation standard in the software industry. But it fails to undoubtedly prove its applicability and then be widely adopted. Why?

Code Generation is an Additional Means, Not a Target

MDD (Model-Driven Development) is a false good idea. It is intended to use code generation as an end, and not a means. The real end is a useful, stable and maintainable software. Code generation is just an additional way to achieve that end in addition to inheritance, polymorphism, generics, aspects and interpretation/introspection. All these solutions aim at one ultimate target: REUSE, avoid duplication of any piece of logic in the code.

Do we constrain ourselves to use generics or aspects in every class, every method even before having started coding? No!!! We should behave the same with code generation and keep in mind that code generation is the last option since we lose the compiler/editor instant validation or assistance and we increase the development environment complexity (generative build system, generated code manual change management, model maintenance/migration, ...).

Communication Models are not Coding Models

Models (graphical or textual) can be used to conceptualize, and communicate. They are indeed formal diagrams. Models can also be used to produce the source code in a generative way. They are then high-level programming languages. Inevitably, there will always be a big difference between these concept-oriented models and code-oriented models just because the goal is not the same. In the former case, we want the model to be communicative, thus simple and clear (less is more). In the latter case, we want the model to be complete, perfectly detailed so that its complexity reflects the logical complexity of the application. That is why the methodologies that prone that user requirements can be enforced using transformation and code generation (e.g. MDA: PIM -> PSM) are misleading.

Then, What To Do?

The problem is not code generation itself but rather the MDD (Model Driven Development) methodologies that tend to use anarchically models and code generation just because it sounds good. On the other hand, code generation is underused and too many of today's software are cluttered with duplicated pieces of logic that harden the development/maintenance and lead to continuously reinventing the wheel for each project (best practices, design patterns, ...).

Code generation should be used as a last resort for project parts as small as possible that need but cannot be factorized in a more traditional way.

How To do?

The correct way of handling MDD is to consider it as a tool/technology but not as a method. All the other well-known methods can use MDD by following these rules:

  • The DSL is nothing more than the formalization of differences between many similar bunches of code. Then always start by manual coding and then instead of copying/pasting a code, use the differences to create the DSL. Starting the DSL from scratch would be painful and sometimes without a real value added.
  • Prefer OO facilities to DSLs whenever it is possible.
  • Use the existing code to create the templates (code generation) or the engine (model interpretation).
  • Instead of continuously growing the DSL for very specific needs, allow to add hand-coded customized features (by specifying a class, a script, …).
  • Do not hesitate to create multiple DSLs for the same application as fewer as possible and then optimally reusable.

Now let's create a shell script DSL from the 2 following scripts by following the previous rules.

#! /bin/bash

usage ()
     echo "vsleep: sleep for some seconds by display a countdown timer"
     echo "usage: vsleep countdown
     echo "- countdown: the time to sleep in seconds"

if [ $# != 1 ]


while :
    echo "${countdown:-0}       
    if [ "$countdown" -gt 0 ]
    then countdown=`expr $countdown - 1`
    else exit 0
    sleep 1

#! /bin/ksh

usage ()
     echo "timestamps: periodically writes the current timestamp"
     echo "usage: timestamps interval
     echo "- interval: interval time in seconds"

if [ $# != 1 ]


case "$interval" in
	;;				# correct
	exit 1

while true
    echo "--------------------------------(`date`)------"
    sleep $interval

By examining the 2 file differences, we infer the following structure:

And then the following DSL:

(DSL and template created with GenerateXY.)

Successful MDD

We all have used more or less often Model-Driven Factories maybe without noticing it:

  • JMX: model driven factory of management consoles that interprets code-based models
  • EAIs/ESBs (MuleESB, Tibco BusinessWorks, ...) that interpret XML-based models (designed graphically or not)
  • ETLs (Talend Open Studio, DataStage, Informatica, ...): The models are interpreted except for Talend Open Studio that generates the code and runs it.
  • CMS (joomla, wordpress, ...): They are indeed model driven factories that interpret DB-based models
  • ... These are successful applications of MDD.

All these successful MDD factories are bound to recurrent applicative requirements (administration console, integration, ...) and NONE of these tools can be used alone to create a full application, only parts. These tools also allow to plug in manual code for advanced customization (Joomla components, Tibco BW Java methods, ...).


In the near future, DSLs will be systematically used in the software industry. As mentioned above, there are already a lot of DSLs that have been adopted. But definitely, models must not DRIVE a development, but rather be used as tools to simplify it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author


United States United States
No Biography provided

Comments and Discussions

GeneralMy vote of 5 PinmemberLorenzo Gatti19-Jul-11 0:04 
QuestionWorst practices? Pinmember@MarcoBrambi5-Jul-11 2:39 
QuestionDrama for who? [modified] PinmemberVincent Hanniet4-Jul-11 23:42 
I agree with ervegter: misused MDD is really painful and not productive.
That's mainly the case when one wants to build a detailed model of the code, or when one thinks that roundtriping is THE way to use MDD. In fact it's NOT (for example see[^]).
"Good" MDD has momentum nowadays. Two links to illustrate MDE state-of-art :
modified on Wednesday, July 6, 2011 3:54 AM

GeneralMy vote of 2 Pinmemberervegter3-Jul-11 6:32 
GeneralMessage Removed Pinmember_beauw_12-Jul-11 8:12 
GeneralRe: My vote of 2 [modified] Pinmemberervegter15-Jul-11 3:48 
GeneralMy vote of 2 PinmemberPhilip F.2-Jul-11 10:12 
QuestionA blog post, but not an article or a tips PinmemberNicolas Dorier2-Jul-11 7:47 
QuestionExtremely lacking PinmentorDaveAuld2-Jul-11 7:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 12 Jul 2011
Article Copyright 2011 by Olivier TANKOANO
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid