Sparx Systems Forum

Enterprise Architect => Uml Process => Topic started by: Yuki on May 21, 2019, 11:08:45 pm

Title: Can Enterprise Architect generate state machine diagrams from source code?
Post by: Yuki on May 21, 2019, 11:08:45 pm
I'm new to Enterprise Architect. I would like to generate state machine diagrams from C source code, but I can't find any tutorial on this. Does EA have such functionality? If not, what would be the best work around?

Thank you very much in advance!
Title: Re: Can Enterprise Architect generate state machine diagrams from source code?
Post by: qwerty on May 22, 2019, 12:08:16 am
Same answer here as on SO: not possible. Only the other way around.

q.
Title: Re: Can Enterprise Architect generate state machine diagrams from source code?
Post by: Sunshine on May 22, 2019, 06:52:04 am
... If not, what would be the best work around? ...
Depends on specifics like did the code follow the state pattern described in GoF book by Gamma, Helm et al.
Other options to consider are;
a) Elbow grease and do it manually
b) Write a Sparx EA plug-in that parses the code and creates the diagram
c) if using State pattern the could import the code and write script to create the diagram from classes and operations.

Option a) is the easiest for the novice but if you have like 1000 diagrams to create you may want to think about doing option b) or c) depending on how the code is structured.
Title: Re: Can Enterprise Architect generate state machine diagrams from source code?
Post by: qwerty on May 22, 2019, 07:17:11 am
I wouldn't recommend c) since writing a (simplified) compiler for importing a state machine is by far not worth it. And for sure, you don't have a 1000 state machines. Option b) is just futile, but have fun: there's a Feature Request link below right of this page.

q.