Hi Lofi, > -> PIM: the way to document your application model and communicate > with your customers. Also known as Domain Concept in ARIS. > IMO, this is the most important part. I myself don't see so > much value on PSM. I prefer to have my code directly, instead > of seeing UML diagrams with e.g. EJBObject, EJBHome classes, > etc. and have to work with them.
a few months ago, I had the same opinion and considered the PSM as un-necessary. Meanwhile, I have seen customers work with AndroMDA on large projects and have seen problems with template re-use. Templates tend to become quite complex when you try to generate everything out of the PIM. They become much simpler and more reusable when you generate out of the PSM. Tony Mowers reported this months ago when he wrote an XSD cartridge. Today I say: Yes, we need true PSMs and AndroMDA will benefit from them! I'd like to give you (and the list) an example. Before that, I'd like to recap a few definitions of MDA because I feel that there are some misconceptions about what a PSM really is: Model: A model abstracts from a domain. Metamodel: A metamodel is a model whose domain consists of models. Platform: A platform is a set of protocols, interfaces, and semantics specifications. PIM: A model is said to be independent of a set of platforms 1. if its metamodel abstracts from those platforms and 2. if for each abstracted platform there is a sequence of mapping techniques from its metamodel to a metamodel describing this platform. PSM: A model is said to be specific to a platform if its metamodel describes this platform. AST: An abstract syntax tree represents a model using instances of classes of the metamodel. Mappings: A mapping is the process of transforming one or more source models into one target model. - end of definitions - OK, with those terms defined properly, we can go into the example. Two weeks ago, I wrote a class that does a simple mapping (you can say a simple model transformation) from a UML PIM to a Java PSM (tiny parts of those). This mapping did not take place in a template. The task was to write a cartridge that generates interfaces and their implementations in Java, using an AST of UML classes as input. Until that day, I always wrote templates but I saw immediately that this one would become too complex and a mapping could make it simpler. Imagine a UML class with attributes, operations and associations. Imagine what comes out of the mapping: a Java interface with a pair of getter/setter methods for each attribute, a method for each operation and a pair of of getter/setter methods for each association. Everything results in a method! So, instead of writing a template that treats attributes, operations and associations separately, I wrote a class that transforms attributes, operations and associations into simple Java objects that represent methods. A class in the UML model AST is translated into methods in the Java model AST. See getMethodDataForPSM() in the following source code: http://cvs.sourceforge.net/viewcvs.py/andromda/cartridges/andromda-meta/ src/facades/manual/org/andromda/cartridges/meta/metafacades/Attic/Metafa cadeFacadeLogicImpl.java?rev=1.1.2.6&only_with_tag=V3x_MMD&view=auto getMethodDataForPSM() returs a Collection of MethodData objects, and with the following simple template, I could generate the Java interfaces: #foreach ( $method in $class.getMethodDataForPSM(false) ) /** $method.documentation */ ${method.buildMethodDeclaration(true)}; #end That's it! The template engine simply spills out method after method that the mapping class has fabricated. The template need not think about where the methods came from. This is the real value of an explicit PSM-AST: It is only one inch above the code and code generation becomes *really* easy. And the way from PIM to PSM is (at times) much more clear than from PIM to code. Lofi, you see that a PSM may have nothing to do with UML and may live without a diagram. In the future, I'd like to see model transformations in AndroMDA, pragmatically and systematically. Cheers... Matthias --- Matthias Bohlen "Consulting that helps project teams to succeed..." http://www.mbohlen.de/ ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ Andromda-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/andromda-user