3 ms·
What do you mean by breaking the fsm? Isn't the whole point of having a fsm to explicitly describe the entire app-state? Honest question
by gbrits 10y ago
What do you mean by breaking the fsm? Isn't the whole point of having a fsm to explicitly describe the entire app-state? Honest question
- partycoder 10y agoA state machine has states and transitions. Some transitions are valid, others are not. Therefore when you implement a state machine in code the consequence is sequential coupling. Imagine a car class: You have StartCar(), Accelerate(), Break(), StopCar(), SwitchGear(). Can you accelerate with your car turned off? no. Can you stop your car twice? No. So there should be validations in state transitions. Since in this code those are missing, it's possible to arrive to invalid states that can cause undesired behavior. In the "request" npm module (an ambiguous module name that wastes a lot of my time in a regular basis), you can abort a request that has not started. That causes an exception. It took me a lot of time to find it. It was all because of a broken state machine.