Statecharts: hierarchical state machines
21–30 of 91 posts
Re: Statecharts: hierarchical state machines
#22"No statechart will survive contact with real world applications". I mean, when you have external dependencies, multilayer protocols, multithreading, perf requirements, the state will becomes an ugly mess. One can only dream of a clean statechart.
Just don’t use one state chart for everything. Just like any data structure, use multiple of them scoped appropriately
Re: Statecharts: hierarchical state machines
#23Well, this is used in the automotive domain for long time now. Look at matlab/simulink: you can draw your algorithm as a state machine and generate the code out of it. Recently I implemented a state machine to manage a quite complex react component, who moves from one visual state to another through some css transitions. It’s not a difficult state machine, but I think people are not so well versed in it.
Re: Statecharts: hierarchical state machines
#24Re: Statecharts: hierarchical state machines
#25Well, this is used in the automotive domain for long time now. Look at matlab/simulink: you can draw your algorithm as a state machine and generate the code out of it. Recently I implemented a state machine to manage a quite complex react component, who moves from one visual state to another through some css transitions. It’s not a difficult state machine, but I think people are not so well versed in it.
I assume game engines might already have this or sophisticated version of this already implemented.
A general framework is I think more rarely useful.
Unreal Engine is a popular game engine and it seems to contain dozens of different state machine frameworks.
Re: Statecharts: hierarchical state machines
#26"No statechart will survive contact with real world applications". I mean, when you have external dependencies, multilayer protocols, multithreading, perf requirements, the state will becomes an ugly mess. One can only dream of a clean statechart.
Hierarchical state machines are common in hardware development. I've also used them for embedded systems, and dug my way out of spaghetti nightmares in distributed systems by reworking a system into a set of state machines. Is it clean? Not always, it gets messy. On the other hand it is deterministic and traceable to specifications. Specifications as state machines can be easier understood and shared than raw code or…
Re: Statecharts: hierarchical state machines
#27I wonder if it's possible to combine statecharts with durable execution engines like Temporal, DBOS, Restate, etc. At work we use Cloudflare Workflows for managing onboarding and payment workflows. It generates flowchart diagram that is useful for quickly reasoning about what the workflow does, which I guess is what statecharts is trying to achieve.
Re: Statecharts: hierarchical state machines
#28The statemachine itself also forces you to think about which transitions between which states are possible and whst you may need to consider when such a state change happens.
Re: Statecharts: hierarchical state machines
#29The title contains hierarchical, which does not come back in the post. You probably need hierarchy, otherwise state charts become unweildingly large.
Re: Statecharts: hierarchical state machines
#30Glad to see statecharts still getting attention! I created XState, a JS/TS library for authoring, executing, and visualizing state machines/statecharts: https://github.com/statelyai/xstate I've been working on it for 10+ years. The main thing I've learned is that statecharts are most valuable when they're treated as executable behavior, not just documentation. That doesn't mean you need to use them everywhere or mode…