In the last few month, we have been developing a customer project that centers around model-to-model transformation with the target model being AUTOSAR.
In the initial concept phase, we had two major candidates for the M2M-transformation language: Xtend and QVTO. After doing some evaluations, we decided that for the specific use case, Xtend was the technology of choice.
|Comfort||Xtend has a number of features that make writing model-to-model-transformations very concise and comfortable. The most important is the concise syntax to navigate over models. This helps to avoid loops that would be required when implementing in Java
val r = eAllContents.filter(EcucChoiceReferenceDef).findFirst[
|Traceability / One-Pass Transformation||Xtend provides so-called "create" methods for creating new target model elements in your transformation. The main usage is to be able to write efficient code without having to implement a multi-pass transformation. This is solved by using an internal cache to return the same target object if the method is invoked for the same input objects more than one time
However, the internally used caches can also be used to generate tracing information about the relationship from source to target model. We use that both for
Both features have been added to the "plain" Xtend, because we can use standard Java mechanisms to access them.
In addition, we can also run a static analysis to see what sourcetarget metaclass combinations exist in our codebase.
|Performance||Xtend compiles to plain Java. This gives higher performance than many interpreted transformation languages. In addition, you can use any Java profiler (such as Yourkit, JProfiler) to find bottlenecks in your transformations.|
|Long-Term-Support||Xtend compiles to plain Java. You can just keep the compiled java code for safety and be totally independent about the Xtend project itself.|
|Test-Support||Xtend compiles to plain Java. You can just use any testing tools (such as JUnit integration in Eclipse or mvn/surefire). We have extensive test cases for the transformation that are documented in nice reports that are generated with standard Java tooling.|
|Code Coverage||Xtend compiles to plain Java. You can just use any code coverage tools (such as Jacoco)|
|Debugging||Debugger integration is fully supported to step through your code.|
|Extensibility||Xtend is fully integrated with Java. It does not matter if you write your code in Java or Xtend.|
|Documentation||You can use standard Javadocs in your Xtend transformations and use the standard tooling to get reports.|
|Modularity||Xtend integrates with Dependency Injection. Systems like Google Guice can be used to configure combinations of model transformation.|
|Active Annotations||Xtend supports the customization of its mapping to Java with active annotations. That makes it possible to adapt and extend the transformation system to custom requirements.|
|Full EMF support||The Xtend transformations operate on the generated EMF classes. That makes it easy to work with unsettable attributes etc.|
|IDE Integration||The Xtend editors support essential operations such as "Find References", "Go To declaration" etc.|
The Xtend syntax on the other hand is not a language based on any standard. But it’s performance, modularity and maintenance features are a strong argument for adding it as a candidate for model transformations.