Home

Xtend2 compared to Xpand

Within the past two years I was working on two Xpand to Xtend2 migration projects. In this post I sum up some of the experiences I made with the two generator template languages. The experiences are based on Xpand 1.2.1 and Xtend 2.4.1.

Xtend2 good parts

It is possible to debug Xtend templates in Eclipse. This is a very helpful feature and was not possible with Xpand before. The overall tool support for Xtend is better.

It is no more necessary to learn two or three languages. Instead of coding in Xpand, Xtend1 and Check it is possible to simply use Xtend for everything. Xtend is a very nice, concise and powerful language and by far not so boilerplate like Java. Actually Xtend is a GPL and could be used as a replacement to Java.

Generating with Xtend is a magnitude faster than generating with Xpand. The Xtend compiler is quite slow, but if Xtend is already compiled to Java, a generation process will run very quickly. Xtend templates are compiled to Java in advance and not interpreted like the Xpand templates.

Another benefit is that generating with Xtend templates results in a way cleaner output. There are no more endless unwanted empty lines or whitespaces in the generated end results. The output is usually very well formatted and there is no extra formatter required.

But be aware, there are also some bad parts...

The not so good parts of Xtend2

So far editing Xtend 2 in Eclipse is still darn slow. And the editor itself provides not much tool support. It is better then the tool support for Xpand, but there are almost no refactoring’s. The few simple refactoring’s that are provided are very unreliable and produce Exceptions. If there were no code completion and syntax/error highlighting I would recommend using a simple Text editor instead of Eclipse.

Final words

Xtend is a great language. Java developers will love it. Maybe some day the IDE support in Eclipse is better and the compiler faster. Then I guess Xtend will receive a lot more attention and adoption. The language on its own has a lot of potential and I like its syntax over Groovys, Scalas or Javas syntax.


Date published:
Date modified: 2013-12-09
Keywords: Languages, Xpand, Xtend