Book a Demo

Author Topic: Statecharts and code generation  (Read 3101 times)

cokecan

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Statecharts and code generation
« on: February 17, 2004, 07:38:33 am »
Hi all

Poseidon (I'm led to believe) can generate code to implement statecharts.

Is EA able to do this? Can't see anything that says it can, the help only mentions classes, attributes and function stubs

BTW, I'm liking EA 4.00 :-)

Regards
cokecan
« Last Edit: February 17, 2004, 07:39:06 am by cokecan »

mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: Statecharts and code generation
« Reply #1 on: February 18, 2004, 01:14:17 am »
You are right. EA can't generate code for behavior.

In my opinion, adding that sort of capability to a tool introduces a whole new range of problems. The code quickly gets either inefficient or platform dependent (e.g. how are asynchronous events passed? This is OS dependent).

Mikkel

thomaskilian

  • Guest
Re: Statecharts and code generation
« Reply #2 on: February 18, 2004, 02:18:46 am »
I second Mikkels opinion. Once I implemented code generation for state charts using the automation interface from Rose. I can't imagine how to make this platform independent. My implementation had tons of dependencies related to the special environment I was using.

Thomas

angel-o-sphere

  • EA User
  • **
  • Posts: 112
  • Karma: +0/-0
    • View Profile
Re: Statecharts and code generation
« Reply #3 on: March 08, 2004, 07:58:01 am »
There exist lots of design patterns for that problem. Look into the PLoP books, Pattern Languages of Program-Design.

Of course its not EASY, you have to design a frame work for implementing state machines and states and map the generated code to that framework.

With that way you can leave enough hook points for the user to adapt the generated code by overwriting predefined methods. An easy way would be to sue C++ templates(for C++ only) because thayt allows to use inline hook mthods which get optimzed away if they are empty.

The most important thing is: generate not code but models ... as far as I know this is currently rarely done in other case systems or not at all.

E.G. use an imaginary frame work, and create a state machine class and state attributes or state objects according to that frame work inside of EA. Don't generate code, generate a skelleton class model from state diagrams and activity diagrams ...

Regards,
  angel'o'sphere

P.S. I only wished EA was a Java program and not a windows only program :-/ then I could hepl in writing such a transformer
« Last Edit: March 08, 2004, 07:59:25 am by aos »