Mendix is a model driven fast application development platform.

The Mendix Desktop Modeler is used to develop Mendix applications. The desktop modeler is a C# application, running under Windows and has been the only application that can create and change Mendix models.

The meta model for the mendix modeling language was embedded in the C# code, and recognizable by the use of C# using annotations. The annotations specified which C# classes were part of the meta model and the storage format used for these classes.

When Mendix decided to start developing a web modeler they realized the need to maintain guaranteed 100% consistency between the meta model used in C# and the one used in the web modeler.

To realize this, we defined a custom meta model specification languagu, called MxCore). We then extracted the meta-model from the C# code and used this to generate a first version of the meta model in MxCore. As the C# abnotations were not complete, the meta model needed to be completed manually.

Resulting Meta Model

The resulting meta model it currently being used to:

  • Generate C# code, replacing the old manually written C# meta model code.
  • Generate Scale runtime code.
  • Generate meta model documentation references.
  • Generate meta model diagrams for use inside documentation. See the diagrams in [https://docs.mendix.com/apidocs-mxsdk/mxsdk/domain-model-metamodel] for an example.
  • Generate the Model SDK, a TypeScript/JavaScript SDk to access mendix models on the web.
  • Generate the meta-model schema in JSON for use in the Model Server. Together with the Model SDK, this is th******e foundation for the new Web Modeler.

To be able to generate all these artefacts in a way that they would fit within the exiisting architecture, we needed annotations on the meta model per generated artefact type. To support this we extended MxCore to allow annotations for the various artefacts.

The newly developed artefacts for the Web Modeler and Model SDK are generated directly rom the meta model, without any annotations.

Versioning

Versioning models and meta model is often forgotten, or at least added as a (too) late addition. The Mendix Meta Model changes quite a lot, resulting in new versions almost each month. Because of this one of the requirements for the Model SDK is the support for multiple meta model versions with one SDK. This is done though so-called version annotations, which allow a developer to have one meta model specifciation that includes all meta model versions. From this meta model with all versions included we generate Model SDK code that understands all versions of the meta model.

Model Units

In the desktop modeler it has always been feasible to keep the whole model in memory. For the Web Modeler, is is important that you can edit parts of a model without the need to have a full moel in memory. This is especially the case with large models.

One of the concept in MxCore is the notion of Model Units. The main idea is that a model is split up into separate model units, where each model unit has a public part (the model unit interface) and a private part. Within a model unit you can only reference elements in other model units though its interface.

This concept has been described under the term Partial Models at the ECMDA-FA 2007 conference in Building a Flexible Software Factory Using Partial Domain Specific Models.