|
|
|
|
|
by IamNotAtWork
3032 days ago
|
|
I really don't like state machines because if you need to add a new event, each of the states need to be updated to handle that event. If you add a new state, you have to figure out how to handle each of the transitions from other states. So as your states grow, the maintenance on the developer's side grows faster than linear. Additionally, I find that I cannot understand how the program works without actually drawing out the state machine diagram if I come across it the first time, so there is a bit of a learning curve. It's also a nightmare to test because of all of the states that need to be tested. So in summary, not a fan. Like recursion... if it feels natural then use it, but I don't go and try and turn stuff that isn't a SM into one or turn something that can be done as loops into recursive function for fun. |
|
State machines have been designed to neatly capture and componentize exactly that.
Anything else is less explicit, and even more error prone.
That new even and those new transitions you've mentioned? You still need to handle them anyway -- only you do it in an informal manner without a SM.