4 ms·
They still go into trap states. If you try to remove default transitions your source code complexity explodes.
by tlarkworthy 3y ago
They still go into trap states. If you try to remove default transitions your source code complexity explodes.
- nailer 3y agoHrm. I used to not understand what state machines were (I don't have a CS degree) and mistakenly think they were adding complexity. I use them regularly now. I make my own, so they don't have default transitions to remove (beyond throwing 'not implemented' errors when I haven't built a particular transition yet), and I'd still say they're less complex than managing state without them. Thinking about 'remove default transitions' - are you talking about using a particular state machine library? My default model is writing them. It's kind of like using a feature flag library when a hashtable with features for keys and boolean values will do. OK maybe use a library if the library adds realtime control etc, but not for the basic concept of flags - likewise a state variable and a single transition function work very well for state machines.
- tlarkworthy 3y agoThe idiomatic calculator interface is actually very hard to implement without bugs https://mitadmissions.org/blogs/entry/designing-a-calculator-with-fsm-logic1/ https://mitadmissions.org/blogs/entry/designing-a-calculator... FSM don't help with the bugs. You need analysis on top to actually make a dent in the bug count