Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » The quality of an xPand template
The quality of an xPand template [message #501159] Tue, 01 December 2009 06:12 Go to next message
Eclipse UserFriend
hi to all..

how can I evaluate the quality of my xPand template file?
are there any quality aspects or criteria that must/should be considered?


Thanx in-advance
Re: The quality of an xPand template [message #501248 is a reply to message #501159] Tue, 01 December 2009 11:26 Go to previous messageGo to next message
Eclipse UserFriend
Hello Wafi,

Xpand templates should be in first order easy understandable and well structured. To achieve this you can follow some guidelines:

1) Don't let template files get too large. Delegate to other files, split per artifact, create common template code etc.
2) Don't let DEFINEs get too large. Delegate to other definitions.
3) Don't use too much logic in Xpand.
- check model for consistency before Xpand execution. No need to handle special situations that come from inconsistent models in Xpand code (like "if feature something is not set then create special code, otherwise take information from the model").
- Use M2M transformation to autocomplete the model according to conventions (e.g. set the name of unnamed association ends)
- Use Xtend functions for non-trivial evaluations
4) Don't use LET, prefer Xtend functions.
5) Don't use PROTECT when the generation gap pattern can be applied
6) Use the Xpand profile (available from 0.8.0-M3) to identify performance bottlenecks. It can also be useful to identify unused templates and Xtend functions.
7) Optimize the template for readability of the template, not of the generated code. Use Code formatters as postprocessors when possible.
8) Set the file encoding as project-specific setting. Good choices are ISO-8859-1 or UTF-8.
9) Don't use too deep loops or conditions. Delegate to sub-templates.
10) Whenever some expression is used several times, create an Xtend function.
11) Don't use too many EXTENSION declarations in the template. Use a template specific Xtend file and reexport required extensions.

I hope this helps you a bit.

Kind regards,
~Karsten

[Updated on: Tue, 01 December 2009 11:26] by Moderator

Re: The quality of an xPand template [message #501504 is a reply to message #501248] Wed, 02 December 2009 10:27 Go to previous messageGo to next message
Eclipse UserFriend
This is very nice.. Thank you alot
Re: The quality of an xPand template [message #507678 is a reply to message #501159] Thu, 14 January 2010 06:08 Go to previous messageGo to next message
Eclipse UserFriend
hello Karsten,

i would like to use these notes in my thesis.. Can I write them as they are without citing, or can you give me a reference to cite them? I am not sure if inserting a cite to this forum is correct?

[Updated on: Thu, 14 January 2010 06:09] by Moderator

Re: The quality of an xPand template [message #509590 is a reply to message #507678] Sat, 23 January 2010 07:21 Go to previous messageGo to next message
Eclipse UserFriend
I'm not sure whether it is formally correct to cite a forum post, you'll have to clarify with your mentor. I'm afraid I cannot give you another link.

~Karsten
Re: The quality of an xPand template [message #510657 is a reply to message #509590] Thu, 28 January 2010 04:26 Go to previous message
Eclipse UserFriend
may be you can list them in your blog..?
Previous Topic:Any trigger action for M2T?
Next Topic:[Acceleo] Suggestion : icons for autocompletion
Goto Forum:
  


Current Time: Mon Mar 10 19:48:39 EDT 2025

Powered by FUDForum. Page generated in 0.05776 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top