From time to time we see a question like “Can I generate 100% of my code from UML models?” (e.g. here ). The answer is YES but to me, this is the WRONG question.
Sure, you can generate every single line of your application code from your UML models (if you think UML is not expressive enough take a look at UML Executable ), however to me the important question is when is it worth to do it? .
Specifying a UML model precise enough to represent your full application behaviour is very time-consuming so it´s not obviuos when this is the most productive way to proceed. I don´t think anybody can give a clear answer to this. There are many factors to consider like the benefits of models when maintaining the application in the future; also the use of DSLs instead of UML could bring productivity improvements in some domains.
However, what I do believe is that:
- 20% of the modeling effort is enough to generate 80% of your application (my Pareto principle for MDD ). Therefore at least this 20% of modeling IMHO is completely worth.
- Try not to mix generated and manual code in the same artefact. It´s ok not to try to generate all the artefacts of your application from models but those that you do target, try to generate them completely. Otherwise the development process gets very complicated.