Enrich your EMF models with Scala

Session Type: 
Standard Talk [25 minutes]

An EMF model can be enriched with structural constraints and definitions of operations bodies and derived features. While these extensions can be implemented in plain Java, the lack of lambda expressions results in a code that is usually far from clean and concise with the expressed concern being lost among Java constructs. A common approach is to use OCL (Object Constraint Language) with the appealing short “to-the-point” expressions. Based on our experience, however, we found that using OCL in larger EMF models brings a number of shortcomings that eventually led us to look for alternatives. Some of the encountered problems are related to OCL itself and its tool support, but also to the way structural invariants are organized.

In this presentation we will show an alternative approach based on an internal DSL in Scala. By using this modern multi-paradigm programing language we can realize an internal DSL with similar features found in OCL while taking full advantage of the host language including state-of-the-art tool support.

In particular we will show:

  1. how to seamlessly integrate Scala and EMF to be able to write similar OCL-like expressions,
  2. improved constructs for capturing structural invariants that supports better user feedback, dependent constrains, flexible context definition, quick fixes and reuse.

The support for the new invariant constructs together with the Scala integration have been realized in a framework called Sigma (soon to be open sourced). While we use Scala for the internal DSL, the framework itself is generic and other JVM based languages with similar features (like Xtend) can be also used.

You will leave this talk enriched with a pragmatic approach that will allow you to easily enrich your next EMF models.

Schedule info



Eclipse Technology
Experience level: 

Copyright © 2012 The Eclipse Foundation. All Rights Reserved.