In an ideal world, business code would be decoupled from implementation details. It would be domain driven and self-contained; it would live in a single location, and that would make it easier to maintain.
In practice, things get messy. Business code gets scattered in a Java/OSGi back-end – potentially distributed –, in a Web front-end written in TypeScript and in a native app for a phone or a tablet. In each of these platforms, these domain objects and behaviours are bound to libraries and frameworks, be it for UI databinding, REST access, database mapping, or bridging a fancy new Big data system. Let it simmer for a while, then end up with a number of domain mismatches and idiosyncrasies. Can we do better?
Model-driven engineering aims to help developers deal with implementation details by letting us focus on higher-level domain models. In its lighter form, it is a common approach: a number of popular projects have domain-specific languages to generate bindings (e.g Protocol buffers), technical/optimised code (e.g Antlr) or scaffold applications (e.g Rails).
This approach is particularly popular in the Eclipse community, where it was taken a step further. The Eclipse Modeling Framework (EMF) is at the core of a rich ecosystem that consider models first-class constructs. It makes the creation of custom models easy, and projects gravitating around it provide out-of-the-box – yet customizable – diagrammatic views, database mapping, UI databinding, and much more. Still, EMF has not been adopted in the Java community at large, probably in part because benefitting from the full experience provided by extensions makes EMF leak in your APIs' design and dependencies.
In this talk, we will see how OSGi and modeling complement each other in a modular, OSGi-powered EMF-like framework, and how models can help developing OSGi applications.