Code Generation from Stereotypes

Please use this forum for open discussions about Bouml.
Merci d'utiliser ce forum pour des discussions ouvertes à propos de Bouml.

Code Generation from Stereotypes

Postby Arg » Mon 5 Jun 2017 20:25

Hi
I am new to BOUML so it is possible I have missed this.
I want to extend UML using stereotypes so that when I assign a stereotype to a particular element the code that is generated for the element can be modified by the assigned stereotype.
At first look this seems possible, but I can only see this for the existing stereotypes. It does not seem possible to extend the stereotypes with user stereotypes for the purpose of code generation.
Am I missing something

Example
I would like to extend an Operation with the stereotype <<log>> that would surround the "body" code with a pair of longing function calls. Whilst leaving the other operations without the stereotype with the default generated code.

Thanks
Arg
 
Posts: 2
Joined: Mon 5 Jun 2017 13:24

Re: Code Generation from Stereotypes

Postby Bruno Pagès » Mon 5 Jun 2017 21:25

Hi,

This is possible, some topics to know :

Kind regards
Bruno Pagès
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 441
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: Code Generation from Stereotypes

Postby Arg » Mon 5 Jun 2017 22:43

Hi, Thanks for the quick reply
My thoughts on the solutions you suggest.

1st point I think I got, but this would require me to modify each operation by hand. Not the idea I could just add it to the code.
2nd point requires me to write a plugout. Would be better but I would have to change the plugout when I wanted to modify the code
3rd point is probably the closest solution. To write a plugout that allows me to configure the code generation sections in my stereotype, and when they are applied to the element the elements code generation sections will be replaced by those in the stereotype. If this is possible.

This would then allow the user to configure the code generation within the model.
I must say I am surprised that this does not already exist as it would improve the versatility of your program considerably. It would allow Bouml to be used for simple DSL (Domain Specific Language) without the need for additional programming.

I will need to think about this. It is more work than I expected.
Arg
 
Posts: 2
Joined: Mon 5 Jun 2017 13:24

Re: Code Generation from Stereotypes

Postby Bruno Pagès » Tue 6 Jun 2017 06:57

Hi,

It seems I wasn't clear but the first and second topics I mentioned was just present to introduce required material to understand the third topic being the answer to your problem ;)
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 441
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: Code Generation from Stereotypes

Postby joan » Wed 30 Aug 2017 13:21

Hello,

I would also vote for customizable code generation based on stereotype ;-)

Joan
joan
 
Posts: 4
Joined: Wed 30 Aug 2017 11:20

Re: Code Generation from Stereotypes

Postby Bruno Pagès » Wed 30 Aug 2017 15:23

Hello,

As I said associating plug-out(s) to the stereotypes (part of profile) you can automatically set the artifact/class/operation/attribute/relation definition/declaration to generate the code you expect

What is the problem ?
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 441
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: Code Generation from Stereotypes

Postby joan » Wed 30 Aug 2017 18:32

There is only one problem - the time for learning and writing plug-outs :)
joan
 
Posts: 4
Joined: Wed 30 Aug 2017 11:20

Re: Code Generation from Stereotypes

Postby Bruno Pagès » Wed 30 Aug 2017 19:47

it is easy, you have tutorial to have an idea of that
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 441
Joined: Mon 20 Feb 2012 08:23
Location: France


Return to Open discussions / Discussions ouvertes

Who is online

Users browsing this forum: No registered users and 1 guest

cron