Generating Business Applications from Executable Models Using Xtend and Eclipse UML2


This presentation will describe the anatomy of an open-source code generator written in Xtend that can produce fully functional data-centric applications on the Java EE and MEAN* stacks from executable models created with Eclipse UML2 (via TextUML), and the challenges in building such generator. The generated application will include a REST API, a user interface, database persistence, domain layer, and a suite of functional tests.

While code generation from models is common place, the typical code generator will take care of producing only the boilerplate code, leaving to the user the task of writing the actual business logic in the target language by hand, which defeats some key benefits of model-driven development. In order to fully reap those benefits and be able to produce entire running applications from models: i) models must address not only structural but also behavioral aspects of the application domain and ii) code generators must be able to translate the behavioral aspects to the target platform. This presentation illustrates this approach using Xtend as the programming language for the code generator, Eclipse UML2 for traversing rich UML models and TextUML for building such models, and the JavaEE and MEAN* stacks as target platforms.

The target audience is made of architects and developers with previous exposure to code generation (with or without Xtend). After the presentation, attendees should be able to use the generator described as-is, modify and extend it to satisfy their specific needs, or use it as a basis for writing full code generators for other target platforms.

Much of the functionality described here is available today as part of Cloudfier (, a web-based platform for rapid development and deployment of business apps that uses Eclipse Orion as its development environment. It will also soon be available as a set of Eclipse plug-ins.

* MEAN stands for: Mongo / Express / Angular / Node.js


Session details
Speaker(s): Session Type: Experience level:
Track: Tags:
Schedule info
Session Time Slot(s):
Sandpebble AB - Tuesday, March 10, 2015 - 10:30 to 11:05


Ian, it definitely fits both Modeling track and Xtext day, so much I originally had it there but then changed my mind. Xtext day explicitly states code generation (the emphasis in this talk) as one of the topics of interest, so I'd rather leave it in Xtext Day (Xtend being an Xtext-related technology and all). I submitted another talk to Modeling, that is more about modeling end-to-end than this one.

Frankly speaking though, I'd like to increase my chances of being accepted, so whatever organizers of both tracks think is best to improve my odds, I am happy with it.

Public comment

If the only relation to Xtext is that you used Xtend to implement a code generator, than it doesn't fit well in the Xtext Day, as here the focus is really on language engineering with the Xtext framework. So I agree with Ian, that it should be 'modeling'.

Public comment

Fair enough... in my defense, I read the 'code generation' bit in:

...presentations on any topics related to Eclipse Xtext, such as domain-specific languages, code generation, compiler construction, or user stories about Xtext

and assumed it was a good fit as Xtend is the main surface feature of Xtext w.r.t. code generation.

BTW, Xtend was not just an arbitrary choice, I really could not build (at least in an economic way) the kind of generator I am planning to present with any other language (tried Velocity, Java, StringTemplate, and Groovy before), and that is going to be one of the takeaways of the presentation.

Finally, the input metamodel (whether is UML or a custom one in Xcore or Ecore built using Xtext) shouldn't make this less relevant to people building code generators in Xtext - the ideas presented will apply to any metamodel capable of representing behavior, and that is also something I was planning to highlight in the presentation as well.

Public comment

Don't get me wrong, I think your presentation is very interesting and I'd love to see it at EclipseCon in the modelling track. I really hope the program committee agrees.
Also it would be nice to meet you in person. :-)

Public comment

This is definitely still a work in progress, but here are links to github repos showing the current status:

* Generator

* Sample generated code (domain model):

* Sample generated code (tests):

* Sample application (TextUML models):

Public comment