Book a Demo

Author Topic: Impressions - State, Activity and Sequence Codegen  (Read 11029 times)

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Impressions - State, Activity and Sequence Codegen
« on: January 30, 2009, 02:11:00 pm »
Hello there,

Now that Sparx's has let registered folkees play with a beta of EA 7.5, can you answer a couple of questions

1.  How does it render a state machine in code? Does it use
     subclassing to represent state or some switch on a attribute,
     or is is user definable

2.  When debugging a state based class, is the current state reflected
     in a diagram ( aka Rose RT and Tau ) ?

3.  Whats the Activity to code look like? Can you reverse engineer
     method ( operation ) bodies to Activity Diagrams.

4.  Whats the game with Sequence to code?

5.   Is there any model simulation?

6.   Does EA 7.5 support C#3 or do you need to have the VS
      Intregation product.

I have a lot more, but that'll have to wait until I can get an evaluation edition... will Sparx be providing evaluation editions;  the seperation between the three new editions ( Bis Arch, Sys / Realtime, Ultimate ( rather Microsoftie that) seems to suggest that.

Thank you in advance, hope you enjoy the experience

Kevin [smiley=2vrolijk_08.gif]

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #1 on: January 30, 2009, 02:46:10 pm »
3. (b) No it doesn't reverse engineer it.

6. Yes, it does.

Anyone holding a current corporate license gets the opportunity during the beta to trial the extra editions.

I suspect, that the trial will now have options for trialling all 6 editions.

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #2 on: January 31, 2009, 05:13:16 am »
Hi'ya Simon

Thanks for the confirming the C# 3... little disappointed about method bodies...

I think it was midnight who first gave me the impression that you'd have state and activity code gen in 7.5 and that it'd be out before my birthday ( day after tomorrow,  so ya still got time to make it a very special day ) ...

7.5 sounds a very interesting product indeed.

Kevin

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #3 on: January 31, 2009, 07:43:50 am »
Sorry Kevin,

I was not trying to give you that impression. I was only referring to an earlier reply by a Sparxian, which was pretty general.

But...

Did you load one of the 7.5 'versions' that included the real-time modeling component? If not, try again. AFAIK the state modeling stuff that Sparx created last year showed up in the beta of the real time profile. That profile seems to be one of the components of the Ultimate edition, as well as one of the <something> engineering editions.

David
No, you can't have it!

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #4 on: February 01, 2009, 12:42:07 pm »
Hi'ya David...

I shall investigate getting 7.5 further ;)

Kevin [smiley=2vrolijk_08.gif]
"... towards so much older"

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #5 on: February 02, 2009, 08:30:38 am »
Quote
... little disappointed about method bodies...

I've seen a few activity diagrams that have been manually modeled from a simple piece of code.  Let me just say, if you expected an activity diagram to be easier to read, you would be more than a little disappointed.

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #6 on: February 03, 2009, 03:31:37 am »
Hi Kevin,

I am actually experimenting with creating an MDA transformation to get a (GoF State pattern like) class structure from state machine diagrams. Also with the new EA7.5 Beta. If you're interested in the results, I'll drop a note here, as soon I have any ...

Günther
« Last Edit: February 03, 2009, 03:32:05 am by Makulik »

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #7 on: February 04, 2009, 06:54:49 am »
Hi Gunther

I would be very interested in such a transform... thank you in advance.

Simon I'm often taken aback by what I'm presented with; page after page of little rectangles and lines, with another set of pages containing text ( not even syntax colouring )... programing has never been easy!

Unfamilar diagrams are difficult to comphrend, but as you become used to them; I would have thought they become easier... personnally I find lines of code baffling and after about a week I can't recall what it was doing... the little sketched out flowchart seems to stick for much longer; and I can get to the whats it up too, much faster ( possibly  [smiley=2vrolijk_08.gif]I've evolved a good notation ).

Perhaps I should pick up the gaunlet and come up with a notation for C# ( I know not everyone uses it, but start somewhere ).

Midnight... apparently this client hasn't got a license ( this makes sense, they don't use UML modeling ... only one set of docs )... so I'll have to wait for a wider beta or the trial ( and no doubt contact Sparx for another extention )...  I'm not going to buy it till it does code gen from activity diagrams - and going the other way is what I really want.

Kevin  [smiley=2vrolijk_08.gif]

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #8 on: February 04, 2009, 12:36:38 pm »
Hi  Gunther,
    EA 7.5 will generate code from state machines by internally transforming them into class models. You can visualize the class structure by importing the generated source.

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #9 on: February 04, 2009, 01:01:24 pm »
Hi Kevin,

>>1.  Each State in the model would be rendered as a function which listens to input parameter ( command ) and execute the appropriate behavior ( and transitions ). The sm logic is driven by a dedicated method which iterates through states and its behaviors(do,entry,exit).

>>3,4. An activity model is internally parsed by EA's graph optimizer to be rendered as code constructs ( e.g: decision/merge as conditional statement or  loop statement, etc ).  Sequence diagrams' messages and fragments are also parsed into similar code constructs. And the code gen templates supplied in EA7.5 will generate code from those constructs appropriately.

You shall also try the new property pages for behavioral elements in EA7.5(Activity,Interaction, Call Actions, Interaction Occurrence, etc)

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #10 on: February 04, 2009, 08:55:12 pm »
Hi,

I came over fiddly things, when writing the transformation templates. The newly introduced %EASL_GET()% and %EASL_LIST% macros described in the Code Generation Template Language of EA7.5 could greatly help to solve my problems, but apparantly these are not supported for transformation intermediary language.
What I am basically trying to do is:
  • Generate an outer interface for a StateMachine class element from all the Trigger elements found in it, those become the interfaces operations.
  • Generate a class for the StateMachine class and a realization relationship to the formerly generated outer interface.
  • Generate an inner interface in the same manner as the outer interface, but with the StateMachine type defined as parameter for all operations.
  • Generate classes for all states found in the original StateMachine element.
  • Generate realization links for all generated state classes to the inner interface.
I couldn't manage to do the transformations for the last point from above, but may be I have still some lack of understanding the usage of the transformation templates.

Günther
« Last Edit: February 04, 2009, 08:56:05 pm by Makulik »

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #11 on: February 05, 2009, 09:54:56 am »
The new macros %EASL_GET()% and %EASL_LIST% are, as mentioned Code generation template macros. So I'm afraid it wouldn't help in performing a transformation of the model into a PSM, but rather generate source code.

But to access the intermediary model, may I suggest a small work around.
 1. Generate source code from the class which contains the state machine.
 2.and then Import the generated source code, to get the class model(transformed classes).
 
 You may indeed modify the code generation templates to achieve what you intend ( e.g: to generate classes for each state instead of operation, please modify the "State" template )

jupeos

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #12 on: February 05, 2009, 02:58:10 pm »
So I try to follow what's called 'the three minute' rule which states that if you can't work out how to do something in three minutes (I think this assumes a certain level of intelligence) then you should ask someone to help you.

So after five minutes of futsing around with 7.5 I conclude there is no obvious way of generating code from state charts (or any other behavioural chart for that matter).

Maybe one of the EA guys can enlighten us (since the help does not) about how this is done? I've been awaiting this functionality for a long time, as others have.

FYI: I opened the EA Example, went to the 'Java Model With Behaviours' package and generated the code...

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #13 on: February 05, 2009, 03:53:03 pm »
First step.
You'll need to have a corporate license.

Second step.
You'll need to have selected the Systems Engineering (or Ultimate) edition when prompted on start up.

Third step.
Generate the class that contains the state chart or activity diagram.

That's it.

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Impressions - State, Activity and Sequence Cod
« Reply #14 on: February 06, 2009, 11:17:36 am »
Hi'ya Simon

Do I take it that, the 'Single User and Developer' license will not include the 'System Eng' or 'Ulimate' editions?  Is this the same for the 'Bussiness Arch' edition?

That would make quite a large price hump...

------------------

Hey Nizam

Does the EA Rev Eng recognise the 'Generated Source Pattern'... that would be very cool; we could hope that it make a good stab at recognising the other constructs ( Seq and Activity )

------------------
!!! Everybody

Thank you for sharing your expereinces...

Just before Xmas, I got to play with Visual Studio 2010... it produced a Squence Diagram from right click menu on method body header or call statement... I think it was quite an early version, it made no attempt to recognise fragments and other grouping techniques that you might employ while modeling.  But it did look cool, and seemed usefull.   I also noticed how 'State Charts' had been dropped ( probably because of the Statefull Workflow Project Templates... a state machine is often an 'Active' - seperate thread of execution... and the first class project idea sits well with me ).

Kevin