Medea is a tool that uses XSLT to generate code from UML models. A system described in a platform-independent UML model is taken as the input to various "templates" that transform the model into software artifacts such as source files, deployment descriptors, SQL scripts or web pages. These artifacts can be compiled into classes, components, application layers and complete executable applications.
Medea attempts to implement Executable MDA (Model Driven Architecture) paradigm where a correctly modeled system can be transformed into working software components and applications.
Why another MDA tool? MDA has been around for a while and proved to work. Popular tools exist, ranging from complete modeling solutions costing thousands of dollars to open-source projects. However, all tools to date have several deficiencies that complicate the MDA process:
Medea simplifies the MDA process by taking a down-to-Earth approach. It does not introduce any new language, markup, or libraries (in fact, the core Medea distribution does not contain any binary code). It is a collection of transformation templates written in a standard language and applied by standard tools.
Let's see what's really happening when a model is transformed into a working application. A UML model can be exported as an XMI file - all leading modeling tools support this. The XMI file is clearly defined and completely describes the model. We then transform this file into text artifacts: code, scripts, descriptors etc. The transformation is defined by a template produced by a software architect. The template must be easy to read and maintain, preferably in a single text file independent of a product or an IDE. So in the end it's just an XML to text transformation.
An obvious choice for this transformation is XSLT - an established and well-known language. As long as a modeling tool can export the model as an XMI file, a collection of XSLT templates can transform it into source code which is compiled into components. This is what Medea really is: a collection of XSLT templates.
Thanks to the introduction of functions in XSLT 2.0, these challenges can be addressed by moving these tasks into XPath queries and functions. At the core of Medea is a library of XSLT functions that hide the complications of working with the XMI format and give the template developer a clean and clear API to:
Armed with this library, a software architect with very basic knowledge of XSLT can produce any number of code generation templates. The learning curve consists of learning a few XSLT statements and a few API functions.
We tried to develop an MDA tool by avoiding the unnecessary functionality, sticking to well-known languages, platform-neutral technologies and altogether keeping it very simple. As a result: