MDE Tools: EMF
In my last post I informally introduced the notion of metamodel and mentioned that one of the tools that is used around them is Eclipse Modelling Framework (EMF). In this post, I am presenting EMF because it is at the heart of a lot of other MDE technologies.
What Is EMF?
From EMF website we have:
The EMF project is a modeling framework and code generation facility for building tools and other applications based on a structured data model. From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, along with a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor.
Let us dig a bit deeper in the different parts of this definition. First, as a modeling framework EMF provides a language to define metamodels. This language has a graphical notation, and EMF provides a graphical editor for this language. The language is serialized to XML and is called Ecore. In particular, you can use ecore to create the metamodel of ecore.
EMF also includes a Java code generator called JET (Java Emitter Template). After creating the metamodel using ecore, EMF allows to generate Java code from the metamodel. This code can be used as a the model layer for a model based application. The generated code is extensible through adapter classes, which implement the adapter pattern.
Finally, EMF allow to generate a basic editor for the models defined by the metamodels. The editor can be generated automatically, and makes extensive user of the adapter classes to edit the created models at runtime.
A Short Tour of EMF
Tools are better demoed than described on a blog post. In the following video we do a 2 and a half minutes tour of EMF and what it can do.