Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagram representation of the state machine #26

Open
GyulyVGC opened this issue Jun 19, 2024 · 4 comments
Open

Diagram representation of the state machine #26

GyulyVGC opened this issue Jun 19, 2024 · 4 comments

Comments

@GyulyVGC
Copy link

Hey, thanks for the cool library!

It'd be nice to add the possibility of creating a .dot file (or similar) for a defined state machine.

This would enable deriving a graphical representation of the states and all the possible transitions via tools like Graphviz.

@GyulyVGC
Copy link
Author

GyulyVGC commented Jun 19, 2024

I've noticed there already is a similar issue open (#11), although I think that producing a .dot file is simpler than an ASCII representation.

@mdeloof
Copy link
Owner

mdeloof commented Jun 20, 2024

Hi, thanks for trying out statig!

Having some sort of visualisation of state machines has been on my todo list for some time now. The major issue I don't really have a solution for is how to deduce the transitions between states. That logic is fully defined within the state handler so it can't be reliably understood by a macro. I've been considering the option to allow users to manually add the possible transitions with some sort of attribute, but then you could run into situations where code and documentation are out of sync, so it's not ideal. 😕

@andrew-otiv
Copy link

Another option is to let your UML diagram be the source of truth and codegen the statig state machine. That creates its own set of challenges... one is that it's challenging to add payloads to your events.

@defigli
Copy link

defigli commented Oct 29, 2024

Btw., there is something similar in https://github.com/eugene-babichenko/rust-fsm . It uses the mermaid but PlantUml would also be great. Or even better to has the format as an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants