Hacker News new | past | comments | ask | show | jobs | submit login

Use them all the time, have for all my career.

They organize complex code, dissect complex set-flag-here-and-test-there spaghetti into a matrix of states and events that can be exhaustively examined and debugged.

Yes you have to organize your code to feed the machine (Vol is hungry! We must feed Vol!) But you have to organize your code somehow, and feeding a state machine can actually be easier to understand that flag-setting. In fact, it makes it absolutely clear what an event is associated with - the machine it feeds.




True, it's better to have a set of states instead of a dozen boolean values. It gives better code, and better organized databases too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: