How compares MDSD to model interpretation coding-style
Hopefully, this question isn't too generic:
Conventionally, MDSD is defined as the conversion of model specifications into sources of compilable programs.
Besides this, one could interpret a model.
While interpretation typically tends to be slower, the deployment of an updated model could be simpler.
In general: Why would one compile a model using MDSD? When should one开发者_StackOverflow interpret models?
What you are talking about is "executable specifications". This works when your specification is complete (e.g., covers all the cases; many current "models" aren't complete, or are complete only by virtue of additional Java source code text in the middle of it, which isn't easily interpreted), and your interpreter is fast enough so the user base doesn't care.
But that's the rub. The whole reason compilers exist is because interpreting specifications is usually 100x slower than a compiled equivalent. (Ever seen or used a C interpreter for real?).
I don't know of many people that execute "models". I think they all believe that an interpreter would be too slow, or they get hung on the model incompleteness/low level source code impedance mismatch.
Both strategies can be valid and valuable under certain circumstances.
When possible, the model interpretation strategy is probably better than the compiled one, since you simply have to modify your persisted model to change the behaviour of your deployed application, without recompilation and deployment.
But you probably need to use the compilation strategy when :
- you cannot express (or don't want) 100% of the required reality in your models. In this case, you probably want to write manual code inside generated code.
- performance is a key issue for your application
I recently developped a GUI model editor, interpreting its models on the fly to render fully operational Form editors. Performance was not a issue, but code was nevertheless generated for these GUIs, since we had huge GUIs with thousands of parameters (for a space flight dynamic application), and many custom UI behaviours that required some additional source code to be fully implemented.
精彩评论