Matrix is a textual modeling language that’s designed to be translated to many existing programming languages such as C, C++, Java and Ada.
The Matrix language provides an extremely high level of abstraction compared to currently available executable modeling languages, that’s because Matrix semantics are especially designed to deal with true modeling concepts. And by being firmly based on the Analysis Design Matrix framework, relational theory and state machines, Matrix provides a solid foundation for future proof software development.
Not only is Matrix able generate today’s and tomorrow’s programming languages (given a suitable Model Compiler), models are also architecture independent. This allows exactly the same model to be targeted to vastly different kinds of software architecture.
Matrix has also been specifically constructed to handle large and complex systems with built-in language components to specify sequential and parallel processing.
With a textual language such as Matrix, model development is often faster due to easier refactoring, merging, differencing and configuration management. Also, the ability to search a model just makes it far more accessible.
Matrix has many new and innovative features. A full list is available here.
The best way of exploring a new language is to see a small but complete example and work through it step by step. We present a model based on the simple and well understood Hello World! program below:
When you’ve recovered from the shock of Matrix not looking like C or Java, remember that this is a modeling language not a programming language. The concepts being manipulated here are different to the concepts controlled in programming languages.
This model, like most Matrix models has two parts. The upper part (M1 silo starting from line 7) defines the analysis model itself in terms of entities, relationships, states, etc. and directly corresponds to the set of
diagrams that form a graphical model. The lower part (M0 silo starting from line 22) sets the initial configuration of the entities in the M1 model. In other words, it defines objects for the entities at initialisation time.
Notice that the Matrix language uses indentation to structure statements. This is important to how regions are defined (the scope over which statements act over other statements and data).
The heart of our Matrix Hello World! model lies in the domain called Friend (line 9) and the single entity named Greeting (line 10). Greeting declares one state (line 14), one event and a single transition from the state (line
When the model executes, a Greeting object is created in the Display state (line 28) and the event named Wave is sent to the object with a Message of “Hello World!” (line 31) which causes a transition out of and back into the Display state (line 21). On entry to the state the single action in the process sequence is executed (line 15). The Message received on the event is then displayed by the Template statement (line 16). A full line by line explanation is given here.
The Matrix Model Compiler enforces a standardised Matrix Coding Style that has the advantage of ensuring all Matrix models everywhere appear with the same organisation and lay-out.
We’re planning to release a free Model Compiler to generate C/C++ source code early Q3 2012. In the meantime, more example models and further Matrix language details will be made available over the coming months.
ICREA Research Professor at Internet Interdisciplinary Institute (UOC). Leader of the SOM Research Lab focusing on the broad area of systems and software engineering