Using Xbase to Define a Generic Graphical View
Xbase is a new component of Xtext. Sven Efftinge who created it explained last year:
Xbase is a partial programming language implemented in Xtext and is meant to be embedded and extended within other programming languages and domain-specific languages (DSL) written in Xtext.
DSLs often need to express some basic behavior which can be combersome when done in a pure declarative way. This has clearly been one of the shortcomings of external DSLs vs internal DSLs. Xbase was designed to fill that gap. However, Xbase was also designed with the Java developer in mind and the (partial) language binds to the JVM. Xbase is statically types, supports generics ... and closures and type inferences. In Xbase, everything is an expression: everything returns something.
Last week, Jan Koehnlein, a core committer of Xtext, and software architect at ITemis, showed how Xbase could be used to rapidly create graphical representations of a model.
Most graphics frameworks in the Eclipse ecosystem provide graphical editors. Usually, the semantic model is mapped to its graphical representation using a hard wired transformation, be it in code (GEF, Graphiti) or in models and a code generator (GMF, the upcoming Spray project).
He created two Xtext 2.0 DSLs which use Xbase. As Xbase is using the Java typesystem, it is easy to navigate the model to create the graphical view. The graphics are implemented using plain GEF and Zest layouts (the Eclipse Visualization Toolkit).
Do you see Xbase filling an important gap in external DSLs? Do you plan on using Xbase for your MDSD projects?
Todd Montgomery Dec 19, 2014