Sparx Systems Forum

Enterprise Architect => Suggestions and Requests => Topic started by: dirc on January 16, 2006, 01:17:39 am

Title: XSLT for MDA/standard code generation templates
Post by: dirc on January 16, 2006, 01:17:39 am
Would it not have been easier to implement the code generation templates as XSLT? I for one am loath to learn yet another language and way of working.

I am aiming to do a lot of code generation using MDA but the templates are somewhat obtuse to say the least and the documentation is dire! I just don't have the time to do this, but it seems to be a necessary evil. At least if were XSLT most developers would get a head start.
Title: Re: XSLT for MDA/standard code generation template
Post by: SF_lt on January 16, 2006, 03:55:11 am
short answer - no
Title: Re: XSLT for MDA/standard code generation template
Post by: dirc on January 16, 2006, 10:10:29 am
and the long answer?
Title: Re: XSLT for MDA/standard code generation template
Post by: Eve on January 16, 2006, 01:49:33 pm
XSLT is a much larger specification and isn't ideally suited to code generation.

I don't see how you could say that the documentation for the code templates is 'dire'.  It's got everything you should need.  Look at http://www.sparxsystems.com.au/EAUserGuide/index.html?codetemplatesoverview.htm

I have heard a few complaints about the transformation documentation, but very few specifics about what people want.

The transformation templates may have been better suited to an XSLT based solution, but using the code templates makes the work load much lighter for people learning and writing both.  It's easy to learn and use, XSLT does not fit into that category in my opinion.
Title: Re: XSLT for MDA/standard code generation template
Post by: dirc on January 17, 2006, 12:34:05 am
1) Have you tried a usability study for the templates and documentation?

Documentation usually makes sense to those who wrote it!

2) Documentation should be task focussed, not feature focussed.

As a user, I would like a walkthrough telling me how to do each stage of the process.

3) Understanding of how to use a library is best learnt through examples.

I would like to see a lot more examples.

=====================================

It might be easy to learn if you are using it constantly, but I would suspect that most users would use it more intermittently. How often does a user typically write transformations? If it is not on a daily basis, then any new 'language ' is going to be hard to absorb. As an architect, I have something of an information overload and having to learn a new language is cumbersome.

In this respect, I think that it would be useful to implement the code generation templates in a standard language. I used Select Component Architect with my previous company and all code generation could be done through VBScript and the object model provided. This was ideal and was quick to implement. ( I still hate Select though..) At least XSLT is widely understood.

Now, if we could do this in a strongly typed language and have the full object model available we would be in heaven.

So, bearing this in mind, I think I might do transformations by writing add-ins... the idiom is a lot easier to understand and I can do it in a language of my choice... well, one day, when I get the time!
Title: Re: XSLT for MDA/standard code generation template
Post by: SF_lt on January 17, 2006, 08:18:21 am
 SparX template language is kind of imperative-declarative language. Of course, tutorial and much more (good) examples needed for easier and quicker understanding.
Template language online help/documentation is tricky, some aspects aren't written at all, only trivial examples, no tutorial, no BNF/EBNF or  metamodel of language - these topics could be improved much by sparxians.
I had and still have a request for TRANSFORM_REFERENCE ;) maybe in EA 12 we'll see it ;D

XSLT has longer learning curve, there is no doubt. And there is no need to take a survey for usability and other things - template language is easier to use, maybe not so powerfull as XSLT would be

IT is a special region of human activity, where learning through the life is exposed mostly - you are forced to learn new things, new languages - it's a price to pay for what you, I and others choose
Title: Re: XSLT for MDA/standard code generation template
Post by: gstatham on January 22, 2006, 02:43:53 pm
We just purchased EA. It immediately became evident that concrete walk-through examples for the code templates isn't out there.  I am responsible for integrating EA into our current code base which means custom templates.  Some detailed examples would be a great time saver.  
Ex: http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp

Are there any plans for tutorials and where do we submit our tutorials?
Title: Re: XSLT for MDA/standard code generation template
Post by: thomaskilian on January 23, 2006, 01:29:13 pm
I'd recommend Sparx official site. It contains lot of useful White Papers that can be used for self study. Several partners of Sparx offer dedicated training. Also there are quite some freelancers to support you on that job.
Title: Re: XSLT for MDA/standard code generation template
Post by: dirc on January 23, 2006, 11:00:13 pm
I have had to bit the bullet and spend some time getting the templates to work.

The real problem I am coming across is that it is really limited and not extensible. For instance, I want a function to change the captialisation of a method, but this does not exist in the code generation templates. (It does in the transformation templates however... why the difference?)

This means that the developers of the template macros have to try to guess what everyone wants up front, which, as we know is impossible.

If we have to keep this template approach (and I'm not a fan) could we at least have some way of extending it by writing our own macros/functions?

Otherwise, could we have the code generation/transformation piece exposed in the API so that we can extend bits in a language of our choice?
Title: Re: XSLT for MDA/standard code generation template
Post by: dirc on January 23, 2006, 11:07:48 pm
Quote

XSLT has longer learning curve, there is no doubt. And there is no need to take a survey for usability and other things - template language is easier to use, maybe not so powerfull as XSLT would be

IT is a special region of human activity, where learning through the life is exposed mostly - you are forced to learn new things, new languages - it's a price to pay for what you, I and others choose


1) I think most developers/architects would know XSLT, surely? It has been core to what we do for years!

2) Constant learning is one thing, indeed my personal motto has always been "Eternal yearning for eternal learning". However, my boss has another viewpoint and keeps asking me when I am going to get the design complete.. it is a commercial requirement that the software be quick to learn and easy to use. No other tools that I have used over the past few years has required me to use a proprietry and quirky 'language'. Rather, you get the ability to extend through a language of your choice, or at least through a language that most people know or, if you don't know it, at least it would be useful if you did learn it, because the skills would be re-usable. And that is core to my requirement.

With the code generation and transformation functionality now available, our lives are being transformed by the ability to automate large chunks of our work and that is a good thing. With the ideas behind MDA (.. and I don't agree with all those concepts, but that's another discussion...) this code generation/transformation is going to be a big part of what we do. I just think it would be worthwhile re-thinking the approach.
Title: Re: XSLT for MDA/standard code generation template
Post by: Eve on January 24, 2006, 01:18:38 pm
I think that there is more power available in the templates than you think.  For starters there is an EXEC_ADD_IN function macro that allows calling an arbitrary function in an addin, written in any language that can interface with COM.

There is the capability to write a function template.  Look at the DDL transformation and the ForeignKey template and how it's called from the connector template.

Then if there's a macro that you need that is generally useful send in a feature request.  You'll probably get it within a couple of builds.

As for functions available in the transforms but not the code templates.  They're not.  They're documented as part of the transformations because they are crucial to transforms, and using them in code templates would break the synchronisation between model and code.

Quote
1) I think most developers/architects would know XSLT, surely? It has been core to what we do for years!

I for one have never learned XSLT.  I've never needed to.  On the other hand, the templates are just if-then-else blocks, looping over elements and string values.

I think most programmers should know these concepts and be able to apply them very easily to a different syntax, surly?  It has been core to what we do for years!   ;)  Maybe that's not true of everyone, but it's a simpler concept to understand IMO than XSLT.

For the record, I know that the code/transform templates are not perfect.  I know they have no use outside of EA, but that doesn't mean you'll never be able to use it again.
Title: Re: XSLT for MDA/standard code generation template
Post by: bmioch on January 24, 2006, 04:02:29 pm
Am I right in saying you guys would like to see a guide to customising code generation templates?
Title: Re: XSLT for MDA/standard code generation template
Post by: thomaskilian on January 25, 2006, 02:19:35 am
For sure!
Title: Re: XSLT for MDA/standard code generation template
Post by: tilemachos on February 09, 2006, 01:06:20 pm
A tutorial with some examples for different programming languages would be fantastic  :)
Title: Re: XSLT for MDA/standard code generation template
Post by: bmioch on March 01, 2006, 07:29:51 pm
We are going to put together a whitepaper that will target some of the things that are currently lacking in the documentation.

There's no ETA, but watch this thread, and the whitepapers webpage http://www.sparxsystems.com/resources/whitepapers/index.html for updates.

Bill