Introduction
This post is going to be very short as there comparison here is rather trivial. Both tools can be integrated with any of the transformation frameworks available in Eclipse.
EMFText does not include transformation nor suggest any specific transformer.
Xtext integrates tightly with one of the transformation frameworks, but can be reconfigured to use others.
Xtext and Xpand/Xtend
Xtext provides an integrated model-to-text (M2T) code generation framework called Xpand. Xpand is a separate Eclipse project (part of the M2T in Eclipse). The integration is relatively seamless and the wizards of Xtext create a separate project dedicated to code generation.
Xtext also provides an integration with Xtend. Xtend can be used to extend Xpand and it can also be used as a model-to-model (M2M) transformation framework.
Xpand and Xtend are mature transformation tools that you can read about here. I’ll not discuss the Xpand nor Xtend framework further in this blog (I’m thinking of writing up a comparison blog of the various M2T framework later).
If for some reason you’d like to use another transformation framework, you can do so with Xtext, although you have to spend some time deconfiguring and reconfiguring your project.
EMFText and Transformers
The short story is that EMFText does not include a transformation framework , but I speculate that this is deliberate!
There are several options for transformation from the abstract syntax (that is the ecore model) in Eclipse (and also outside eclipse) and EMFText allows you to choose whichever toolset you’d like.
For M2T, the obvious choices are Xpand, JET, or Acceleo.
For M2M, there are also many choices (including Xtend). For more information of the M2M projects for Eclipse, take a look at the M2M portal at Eclipse.
Which Approach is better?
If you don’t have a preference for transformation tools, you may benefit from the tight integration that Xtext provides with Xpand and Xtend. The new project wizard creates a complete setup using Xpand and Xtext.
However, if you do have a preference and this preference is not Xpand and Xtext, you may find the EMFText a better starting point as you don’t have to 'deconfigure’ your project to remove the Xpand/Xtend dependencies.
As I said when comparing the development processes, it is unfair to say that one approach is better than the other. They’re just different.
On a personal note, some of my code generators are too complex to use M2T or a trival M2M transformation. I have to run the model through a chain of M2M transformation before the final M2T, in these projects. For these projects I could use Xtext and reconfigure the projects or just simply use EMFText.
Conclusion
Again we’re seeing a slightly different philosophy when looking at EMFText and Xtext. EMFText does not provide any particular code generation framework (or other transformer technologies) and you decide which framework to use.
With Xtext you’ll pay a penalty if you want to use a different framework than Xpand/Xtend, but if you use Xpand/Xtext, configuration is automatic.
In EMFText you would have to configure the code generation framework yourself, but you never have to ‘deconfigure’ the project :)
View comments