Model of a model – metamodel
Every software we develop serves to solve a certain real-life problem. When I say a problem, I mean certain processes that take place in everyday life. To solve the problem, we need to analyze it first. The analysis represents the perception of certain events and entities that are an integral part of every business process.
What if the properties of a system are such that our entities are not known in advance or are very variable? Also, what if we want to develop software that can be applied to several different tests?
The solution could be a model of a model – metamodel. The metamodel is a way to describe a particular entity without defining it during the development process of the software. Metamodel defines the attributes, rules, constraints, and relations in the model itself. With metamodel, we can achieve higher abstraction.
Database metamodel example:
On the example above, you can see how the metamodel could look in the context of the database. With META_MODEL we can define entities, with META_PROPERTY we can define which data will entities contain, and with META_VALUE we can define constraints for those data.
What can be the problem with this approach?
This approach may have its own problems. First of all, the complexity of coding, testing, performances, and integration with third-party software. High abstraction makes coding more complex and I could be difficult to cover all functionalities needed for the software we are developing. Also, every single change is very risky and could be time-consuming.
What’s the solution?
As in most cases, the solution could be a compromise. It is always possible to model the system so that only part of the model is defined by the metamodel. It is even possible to make only certain parts of the entity modeled with metamodel.
For example, if we want to develop asset management software, data such as serial number, production date, price, type, etc. we can define in the model itself and we can define the data specific for each type of the product with the metamodel. In this way, the most important characteristics are defined by the model and less important with the metamodel.
The metamodel is a good way to solve generic problems, but it should certainly be cautious when using it.