Useful resources for creating apps that use the finite state machine pattern
Inspired by the awesome list thing.
Finite state machine won't save the world. This pattern address issues where you want to drive a user from a point A to Z following various state. Thus make sure you really need a state machine before using one. But also make sure you won't need one, because most of the time you will. We have four rules that leads this design:
- The state machine is defined by a finite number of states
- This states are triggered by conditions
- Each conditions shapes transition
- The machine is in only one state at a time; we call it the current state
FSM can be simply compared to somebody with amnesia who is constantly asking: Where am I? What just happened? and…
So what do I do (or where do I go) next?
Robert Drummond
Two other examples where the State pattern is useful include: vending machines that dispense products when a correct combination of coins is entered, and elevator logic which moves riders up or down depending on certain complex rules that attempt to minimize wait and ride times.
dofactory
This man has never heard of video game A.I. programming :)
davedx
There’s nothing to prevent “air jumping” — keep hammering B while she’s in the air, and she will float forever. The simple fix is to add an isJumping_ Boolean field to Heroine that tracks
Robert Nystrom
We Don't Need One Until We Do So, early on you don't feel like your objects' state machine behaviour is complex enough to warrant a "full-blown" state machine (YAGNI and all that jazz), but later on – when it IS complex enough – you feel like you've invested too much time/effort to replace it with something that has equivalent functionality
Alan Skorkin
React thinks of UIs as simple state machines.
- State.js: https://github.com/steelbreeze/state.js
- Machina.js: https://github.com/ifandelse/machina.js
- Javascript State Machine: https://github.com/jakesgordon/javascript-state-machine
- Promise State Machine: https://github.com/patbenatar/promise-state-machine
- Chine: https://github.com/mtabini/chine
- Machineto: https://github.com/itkoren/machineto
- Makina: https://github.com/atabel/makina
- StateJS: https://github.com/hufyhang/state-js
- Mistic: https://github.com/benaston/mistic
- fluent-state-machine: https://github.com/nickuraltsev/fluent-state-machine
- Bon Etat: https://github.com/gausby/bon-etat
- Hierarchical-fsm: https://github.com/cassiozen/State-Machine
- iFsm - jQuery: https://github.com/intersel/iFSM
- State flow: https://github.com/philipdev/stateflow
TODO 🛠