Click here to Skip to main content
Licence CPOL
First Posted 29 Jul 2011
Views 2,689
Downloads 40
Bookmarked 3 times

MDA Tools Vs GenerateXY

By | 29 Jul 2011 | Article
MDA is not for dummies

MDA is Not for Dummies

The OMG has created a standard for MDDs: MDA. It recommends by the way the use of the following languages for implementations:

  • UML for modeling
  • MOF for metamodelimg
  • OCL for model constraints checking
  • QVT for model transformations
  • MOFM2T for templates
  • ...

There are some frameworks that follow more or less these recommendations but the amount of knowledge needed to master them and the delay needed to see the investment return simply discourage a lot of people. Yet MDA should have been systematically used in a perfect world since it is the natural evolution of software production systems.

GenerateXY: Nothing New Under the sun

With GenerateXY, you follow the same MDA approach but by reusing your knowledge to implement technical details. With this knowledge, you can create models and metamodels, check model constraints, do model-to-model and model-to-text transformations, reverse-engineering and model maintenance, all in a uniform and integrated manner:

  • XPath is used for both templating, transformation logic and constraints
  • XML/XSD concepts (element, attribute, complex type, ...) are used for modeling, metamodeling and mappings
  • Tools for reverse-engineering and model maintenance are built using GenerateXY generators

Example

Let's see how we would implement a simple application that is defined by a PIM (Domain), a PSM (DB), a model-to-model transformation between the PIM and the PSM, and model-to-text transformation between the PSM and the code (simple SQL).

1) Using a MDA-compliant Tool

The metamodel

metamodel.png

The model constraints

Context Entity inv:
    attributes->isUnique(name)

Context Table inv:
    columns->isUnique(name)

Model-to-model transformation specification: transform a Domain model to a relational DB model

transformation Domain2DB(in dom: Domain, out db: DB);
    main() {
        var e := dom.rootObjects![Entity];
        e.map Entity2Table();
    }
    mapping Entity::Entity2Table(): Table {
        name := self.name;
        columns := properties->collect(p | Property2Column(p));
        columns += Column {name=self.name+'_id',type='NUMBER'};
    }
    mapping  Property::Property2Column(): Column {
        name := self.name;
        type := self.type;
    }

Model-to-text transformation specification: transform the relational DB model into a DDL file

[module DDLgen(DB)/]
    [template public SchemaToDDL (s: Schema)]
        [for (t:Table | s.table)]
            [TableToDDL(t)/]
        [/for]
    [/template]
    [template public TableToDDL(t: Table)]
        CREATE TABLE [t.name/] (
        [for (c:Column|t.column) separator(',')]
            [c.name/] [c.type/]
        [/for]
        );
    [/template]
[/module]

2) Using GenerateXY

The metamodel + constraints specification using XPath and a XSD-like language

gxy-domain-input.png

gxy-db-input.png

Model-to-model transformation specification: transform a Domain model to a relational DB model

gxy-domain2db-mappings.png

Model-to-text transformation specification: transform the relational DB model into a DDL file

gxy-db-template.gif

No More Duplicate Languages!

The XML standard has been created with some languages for handling most of the needs that come from the use of structure languages: XPath for query/navigation, XSLT/XQuery for transformations, XSD for constraints. These languages are model-agnostic: they can be used to manipulate any kind of structured model. Why continuously reinvent the wheel by creating new languages that do exactly the same job that existing languages already do (E.g.: OCL = XPath)? For very specific needs, libraries or extensions could be added to existing languages. The C++, Java, C# languages are not the best OO languages but they succeeded mainly because they were extensions of the popular C language.

Just a little thought that I wanted to share...

References

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Olivier TANKOANO



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 29 Jul 2011
Article Copyright 2011 by Olivier TANKOANO
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid