I am trying to understand the concrete difference between code generation from a model (e.g. using EMF) and model-to-text transformations using e.g. Acceleo or Xpand. Both concepts use models as input, and the output is the code, that is based on the model, along with e.g. editors etc. I haven't used any of the M2T-frameworks until now, and that's why I am having some problems understanding the practical differences between those two concepts. Could please someone enlighten me in that matter, a head-to-head comparison would be great.
Thanks!
They are different conceptually.
MODEL-TO-TEXT transformation is the process (technique) of extracting code from a model. This tranformation could be defined in several ways, depending on your source metamodel and your destination language. It's the opposite of TEXT-TO-MODEL, that extracts a model analysing the source code.
For instance, you can extract and generate Java code from a UML in a MODEL-TO-TEXT transformation.
Acceleo, for example, is a tool based on standars which makes you possible to make a tranformation MODEL-TO-TEXT. Acceleo needs model (maybe in .xml format or the standar .xmi) and some templates (.mtl) that you define.
With these templates and the Acceleo engine you will be able to parse your model and generate the code you need.
To sum up: MODEL-TO-TEXT is a process, and Acceleo is a tool to develop and run the process.
I hope this helps you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With