Author Topic: EA Code Generated From State Machines Question  (Read 1333 times)

kmgagnon99

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
EA Code Generated From State Machines Question
« on: October 20, 2021, 05:48:17 am »
Hello Everyone!
  So I am completely new to EA (and kind of UML in general). I use Rhapsody at work but I wanted to use something different for being a hobbyist at home so I got EA. Namely I'm a software engineer so the parts I focus the most on is code generation. So I am going to have a ton of other questions but one of my first questions is about the code that is generated from state machines. I do understand that code is generated through code templates with the use of EASL macros to generate behavioral code, such as state machines. So I would like to use this code outside of the bounds of EA (for example using Java code elsewhere as is). So when code is generated I noticed that there are a bunch of print statements as follows:
Code: [Select]
[TestClass:TestClass] Transition Effect: Initial_11__TO__Running_3[TestClass:TestClass] Entry Behavior: TestClassStateMachine_Running
Entering Running state
[TestClass:TestClass] Do Behavior: TestClassStateMachine_Running

Now this is super nice for debugging, but I wouldn't want this to show up all the time since this would clutter up the output. So my question is, is how could I get the code to generate without those print statements and show something like this instead?
Code: [Select]
Entering Running State

I know I could go through and delete it and do it each time but it's kind of wasteful in time. Let me know what you guys are thinking! Hopefully this will be active enough because I have many more questions to come! Thank you for your time!
« Last Edit: October 20, 2021, 09:15:47 am by kmgagnon99 »

qwerty

  • EA Guru
  • *****
  • Posts: 12427
  • Karma: +347/-291
  • I'm no guru at all
    • View Profile
Re: EA Code Generated From State Machines Question
« Reply #1 on: October 20, 2021, 08:46:20 am »
Both of your code sections have the same content...

I would not bother to much with code generation. I think that's a cul-de-sac. Modeling and coding are two different domains and should stay separate. It's difficult to bridge, but that would be the task of the system architect. The model would be some abstract system and allow to keep juggling the balls in the air. Once you got the idea you can shove it over to the coders which can use UML for detailing things in (say) sequence diagrams (unless that will not make them complain about being too hard to use). Juggling looks easy, but everyone knows that it's pretty difficult and needs lots of experience....


q.

kmgagnon99

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: EA Code Generated From State Machines Question
« Reply #2 on: October 20, 2021, 09:18:53 am »
Thank you for your reply! I did not see that my code was the same. I just updated the code snippet. I totally understand your point but again I'm a hobbyist and I'm looking into this code generation so any help would be appreciated!

qwerty

  • EA Guru
  • *****
  • Posts: 12427
  • Karma: +347/-291
  • I'm no guru at all
    • View Profile
Re: EA Code Generated From State Machines Question
« Reply #3 on: October 20, 2021, 09:34:19 am »
Keep on with that! I once started with code generation and went away from that queer macro language to just using the API. That gave me the ability to create ANY code I liked. However, as you could read above, i soon got to the point where I recognized that code generation is futile. I once used Rational Rose for code generation and that was quite nice out of the box. However, based on my experiance I wouldn't go that way further. Good luck with your hobby attempts, though :-)

q.