lundi 27 décembre 2010

Enhancement of EMF Generation - Part One

EGF (Eclipse Generation Factories) is an EMFT component in incubation dedicated to the generation, and more largely it defines a framework for software production. The first domain of interest for EGF is the EMF Generation. The reason is that the EMF Generation represents a good case to assess EGF, and the result can be very useful for the modeling community.

The EMF Generation has reached a very good level of maturity. In this context, the interest of EGF is to enhance it with topics such as team working, reusability, customization of off-the-shelf EMF generations, and facilities to create EMF generation chains.

1. Beyond a work in silos...
The EMF Generation is written in Jet to apply a model-to-text transformation from a genmodel file. In order to customize the generated code, it is possible to override or insert code. The inherent problem with a model-to-text language such as Jet is that reusability is limited: inheritance is not supported, model-to-text scripts cannot be reconsidered later in a new project context, and composition of contributions from different team members is impossible. In other words, the EMF Generation works in silo. However, the fact is that the EMF generation is the result of a long experience and, with all the details and subtleties it contains, it would be uneasy to rewrite and modernize it. Then, what kind of improvement is possible?

2. Executable patterns
EGF provides a first formalism, named pattern. A pattern has roles, a precondition, and a set of methods written in a language such as Jet. Pattern inheritance enables to support polymorphism, and then to have a polymorph Jet; pattern composition enables reusability of patterns in different contexts; pattern merge enables to assemble and integrate patterns; pattern substitution enables to change patterns by other ones and then to reconsider later different parts of a generation. To follow the EMF Generation evolution (Helios, Indigo...), an EGF reverse tool automates the Jet-to-pattern transformation.

3. The team working
Pattern merge enables to integrate customizations of EMF generation written by different team members and then to support collaborative work.

4. Customizable off-the-shelf EMF Generations
Pattern inheritance and pattern substitution enable to reconsider later an existing EMF Generation. Generation blocks can completely be modified, added, or deleted. For projects or companies, the interest is to create off-the-shelf EMF generations which can be adapted to a specific context. Several levels of customization can be created.

5. Maturity levels of the EMF Generation
The EMF Generation is today launched from a genmodel. It is possible to automate a sequence of EMF Generation (e.g., a model, edit and editor generation sequence) in Java (via a generator adaptor factory). The evolution is to easily define and change a sequence of generation. In EGF, a factory component encapsulates a production plan (aka activity workflow) which models a sequence of generation. A production plan successively invokes the EMF Generation steps or specific generation activities. The pattern integration is realized at this level.

This following figure is inspired from the OSIMM (The Open Group Service Integration Maturity Model). In order to avoid any confusion with SOA, the term 'capability' is used instead of the term 'service'. The purpose is to figure out that there are different maturity levels for the EMF Generation. At the level 1, the EMF Generation is realized in silo. At the level 2, EMF generation contributions are not isolated; they are integrated for instance for a collaborative work or for reusing generation elements. At the level 3, a component encapsulates the EMF generation: all the logic of generation is described in a component (data, behavior). At the level 4, the EMF Generation is considered as a capability (or a service) which can be executed like another one, and makes sense by its final result; all the internal mechanisms are encapsulated. At the level 5, the EMF Generation can be combined with other capabilities, for instance the generation of Java doc, diagrams, or combined with other EMF components, such as EEF.

Those maturity levels are combined with dimensions. The two first dimensions consider the EMF Generation without and with customizations. The third dimension addresses reusability, and the last one the product line.

EGF starts reusability with patterns, works at the Component level with factory components, where a factory component can invoke another factory component. A factory component is executed by the user or in headless mode. The Capability level is adressed with the notion of generation chain.

6. Hands on...

  • Download EGF by update site with Amalgam or here.

  • Download examples from the Tutorial page or here

  • The org.eclipse.egf.usecase.emf.uc2 plugin provides examples of customization of the EMF generation with patterns (e.g., new get/set methods)

  • The org.eclipse.egf.usecase.emf.uc3 plugin examplifies how to integrate customization contributions and how to create two levels of customization

  • Examples are in the egf folder. Open an fcore. For execution, right-click on a launcher factory component; the EMF Generation is realized. Patterns are in the pattern viewpoint. The generation sequences are located in a production plan.

7. Conclusion
In order to enhance the EMF Generation, EGF has realized a paradigm shift successively with patterns, factory components and generation chains. Some points of conclusion for this first part:

A/ The EMF Generation is a domain-specific generation for EGF where the domain is EMF
B/ With a pattern-based generation, EGF is able to reproduce the same generation than the EMF generation
C/ Add-value:

  1. Polymorph Jet with pattern inheritance,

  2. Reusability of EMF Generation parts,

  3. EMF Generation in team working mode,

  4. With a production plan (aka activity workflow), ability to define the different steps of the EMF Generation (model, edit, editor, tests) and to insert specific steps

  5. Creation and customization of off-the-shelf EMF Generations, with the possibility to define different derivations of EMF Generations

A next post will explain how to easily set up EMF Generations.

1 commentaire:

  1. Very clear and synthetic presentation of EGF Benois, keep up the good work !