upvote
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 raw prose.

I also think more effort is needed to synthesize a clean set of state machines with hierarchy for a system at scale and I'm sure there are times when that effort is not warranted.

reply
deleted
reply
I’ve used state charts in multi-billion legacy apps and they’ve stayed quite clean.

Just don’t use one state chart for everything. Just like any data structure, use multiple of them scoped appropriately

reply