Planview Blog

Ihr Weg zu geschäftlicher Agilität

Engineering Teams

What the heck are logical models?

Veröffentlicht By Tasktop Blogger
What the heck are logical models?

Have you ever committed to the repository and got mail afterwards “Hey, this isn’t compiling!”? Likely you committed only some of the changes you made leaving out files required for a successful build. Let’s take a look at a simple example:

logical model

In this model we have a class element Some Class in my.ecore which extends AnAbstractClass in Your.ecore. In this scenario, we essentially have a dependency from My.ecore to Your.ecore. For example, renaming the class AnAbstractClass in Your.ecore also forces an update of the superclass property in My.ecore. This means we need to handle this change atomically across both files. In Eclipse, this is a called a “Logical Model”.

A logical model is not necessarily related to EMF but a general concept to represent related files. While we use EMF in this example, the same applies to resources given that there is a corresponding model provider (more on that later). In the past, using CVS or Git as your SCM of choice, committing only changes for one of these files resulted in a broken repository state. Fortunately the Eclipse Platform has had a solution build-in for exactly this problem for years. Being a platform though, Eclipse only provides the necessary hooks but not the actual implementations.

While the Eclipse CVS integration already supports Logical Models, the support in EGit is currently being reviewed for inclusion in the next major release. This means, whenever you’re working with files that are part of a logical model and you’re about to operate on these files, EGit will help you to include all relevant artifacts. Let’s say are about to commit My.ecore to your repository. This will trigger EGit to reach out to the associated model providers asking the question “I want to work on file X, which files are needed to have a consistent model?”. In the case of .ecore files, the corresponding model provider is EMF Compare which answers the question and EGit shows a dialog to widen the scope of the commit operation:

selection

This not only works when committing files to the repository but also when you replace or compare files with an older version.

comparison

The features in EGit are only one side of the equation. We also need a tool that identifies the list of resources that are related to a given set of files. In the open source Eclipse ecosystem, EMF Compare is currently the only provider that handles the notation of logical models. With the support in CVS and EGit, I hope more plugins will contribute model providers to help users keep their repositories stable. 

Ähnliche Beiträge

Geschrieben von Tasktop Blogger