Bringing AOP and MDA Together
Current developments make it even harder to distinguish between MDA and AOP. Both trends influence each other in such a way that they come closer and closer.
Aspects as Models, or Modeling Aspects
Transformations are defined in transformation definitions, which in turn are executed by a transformation engine. Because writing transformation is a lot of work, developers have started to parameterize transformation definitions so that they can be tuned and more widely used. Going further, many developers are now using complete models to parameterize transformation definitions. Models of persistence architecture and models of security architecture have been developed this way. MDA is used to combine such models with the application model, resulting in a combined model of the application plus persistence or security. In effect, the MDA transformation takes two input models and, in AOP terms, weaves those models together. (See Figure 3
). Although this happens at the model level, it is conceptually very close to aspect weaving within the AOP approach.
|Figure 3. Model Weaving: A representation of how MDA weaves the various models together.|
Aspect-orientation has also been taken up directly by the modeling community. There is even an aspect-oriented modeling language, Theme/UML
, which is defined as an extension to UML. Using this approach, aspects may be modeled directly using UML diagrams. The weaving of the aspects now becomes the weaving of models, which is what MDA is all about.
There is an ongoing discussion in the AOP community regarding whether there is even a need for a dominant "base" program. If all parts of the application can be defined by aspects, the base program can no longer be identified. Once this is the case, AOP looks more and more like MDA.
Choice of Concerns
The choice of concerns that should be put in an aspect or a different input model of an MDA transformation is, in many cases, the same for AOP and MDA. From the point of view of AOP, aspects can be used to add technological details to a model. This is exactly what the PIM to PSM transformations are supposed to do. The case of defining persistence is a very good example of this. A specific persistence technology (e.g. direct JDBC access to a database, XML file storage, etc.) is defined using either an aspect or a different input model, while the main application code/model is completely independent from the persistence technology being used.
Generation of Aspect Code
Some MDA approaches not only generate ordinary code, but also generate aspect code. The MDA generation becomes simpler and AOP techniques are then getting used to weave the aspects with the main application. This combines the two techniques directly.
Models as Programs
Another interesting development is the advance of model compilers and UML virtual machines. Using a UML virtual machine, it's possible for an MDA approach to be more dynamic, just as AOP systems already are.
In AOP systems, access to the metalevel is limited. However, nothing in the AOP philosophy stops us from defining more types of pointcuts, thus opening up the metalevel of the source language to allow more expression.