Hello,
I'm implementing the MDA transform support for associations according to the following excellent article
http://www.devx.com/enterprise/Article/28528Now it's simple enough to put this into an MDA xfrm for say, C#, then generate code in the corresponding code template. The templates are quite powerful as it turns out so this is not too hard (once you figure out how to do it!)
But I work in several languages, I'd hate to go into all of them and add the same association transform templates. This way of handling associations is really independent of the language. Why not simply create a new template - like "Association Template" which is used in a transformation chain?
So the MDA process would be
PIM-->AssocTemplate-->PIM1-->C#Template-->PSM-->C# Code Template-->CodeThe C# Template is still needed, at least to set the code gen language in the packages. It probably should otherwise be a direct copy, and shouldn't generate properties (for example) for link attributes (as that has been handled already) More complicated, but cleaner, and now all the common stuff is handled in one place.
Thoughts? I keep going back and forth. With this method the language specific template does very little, which bothers me. OTOH, this brings up the thought that maybe then the default code templates do too much. For example they create constructors/destructors. Seems like that could be moved up to the Language templates, which justifies their existence more. For example
- AssocMDATemplate - creates functions necessary for associations et. al.
- LanguageMDATemplate - also creates language specific operations and attribs, such as constructors/destructors, and fills out collection classes ...
- CodeGenTemplates - These now are much simpler and just do a dumb generation of syntax.
Understandably Sparx has defaults which get you going, but it seems worthwhile to do a full restructuring of them to really harness the power of MDA. Ideas?