MDA/MDD: Model is not code!?Tags:
First of all, let’s define the investigation field:
- MDA/MDD: using models to generate (parts of) code with generators
- Model (in this context): a formal description of (part of) user requirements for an application
- Code: text understandable by a compiler on a platform to run the program that implements the application (note: code stands for source code+configuration files)
Now have a look on the matter from different viewpoints:
- Trivial standpoint:
As proposed in Is MDA the Holly Grail of Agile Manifesto?, in an MDA project model and generators are “source artifacts”.
The MDA equation is: code = generation(model) + non generated code
- Is the model “understandable” by the compiler? Not. It is not built to be. So model is still not code.
- If we decide to call “generation()” a compiler, may the model be called code? Yes. We could call it meta-code in fact as generation() produces code. Eureka! Model is meta-code. Fine.
(but generation() is not a meta-compiler as 1) we called it a compiler, 2) it does not produces compilers!)
- Is meta-code code? Yes meta-code is kind of code, but not of the same order as THE application code.
Why should we boring with meta-thing? Sounds complex and not pragmatic, neither the user nor the developer want to be bored with meta-things. So, stick to “model is not code”!
- Logical standpoint:
In MDA the model is used to: 1) capture a structural organization of user requirements 2) help mapping this structure with an application logical architecture. In OMG’s MDA definition this model is called Platform Independent Model (PIM)(*).
- So model is an extract of a theoretical model of business needs. Meanwhile code is something to be compiled to produce an application program. We clearly don’t speak of the same level of representation. Model is not code.
- What if the model is executable?… Why should it be? We don’t expect this from the model which describes user needs. Keep things simple. Model is still not code.
- Near the bounds:
- Original MDA goal is said to transform a Computational Independent Model (CIM) into executable code through successive models transformations: CIM > Platform Independent Model(PIM) > Platform Specific Model (PSM) > Code. What a Weird idea! Probably too much beer… ;D
- Executable models are another curiosity, raised in a tentative to build an Agile MDA approach. It even seems that Executable UML is still alive. Probably some survivors from the first MDA raft… ;D
But even this way, the model is still meta-code, or at least parameters. And real code pieces are hidden into transformation/generation rules.
Model is not code in real life for MDA/MDD. Not an absolute conclusion as we could have chosen other hypothesis. But this choice is for sure compliant with the KISS principle…
By the way, is MDA/MDD compliant with the KISS principle? Yeah. I’m sure. I’ll show it in another post ;D
(*) All successful MDA projects that I know use only PIM among the CIM>PIM>PSM>Code MDA’s canonical transformation chain
Featured image taken from http://www.redsen-consulting.com/2011/06/quelle-forme-pour-mon-modele/