3 ms·
I feel state machines might be better represented as validations happening behind the scenes, e.g. if my coffee machine's state would go from COFFEE_READY to CU
by strken 4y ago
I feel state machines might be better represented as validations happening behind the scenes, e.g. if my coffee machine's state would go from COFFEE_READY to CUP_PLACED then allow it, if it would go straight to COFFEE_POURING with no cup then throw an error. I'm not convinced you need explicit events, and think most of the value is in preventing nonsensical transitions between states.
- sgtnoodle 4y agoThat reminds me of traffic light controllers at intersections. There's often a main controller, and then also a safety monitor that simply watches for invalid combinations, such as original orthogonal traffic both getting greens.