Because the creator's a fan of Alex Garland? (EDIT: I think too that "out of the machine" is not a terrible, if also not a terribly enlightening, description of how a state machine makes decisions.)
It wasn't immediately clear to me, but this library tracks both the state (e.g. "state1") and a payload, some arbitrary value. This already seems like two separate concerns?
As for transitions, it seems that each state has a collection of functions for every other state, which are called with the payload to determine if that state should be transitioned into. This seems error-prone - if there's no transition, is that the end or an error? If there are multiple, how do you choose?
It also seems that the state machine will run immediately to completion unless you return a promise payload. (Bluebird? ES6? It doesn't say.) So if you want a reactive document, this doesn't seem like a fit.
7 comments
[ 4.2 ms ] story [ 24.6 ms ] threadhttp://docs.openstack.org/developer/automaton/api.html#machi...
Code @ https://github.com/openstack/automaton
As for transitions, it seems that each state has a collection of functions for every other state, which are called with the payload to determine if that state should be transitioned into. This seems error-prone - if there's no transition, is that the end or an error? If there are multiple, how do you choose?
It also seems that the state machine will run immediately to completion unless you return a promise payload. (Bluebird? ES6? It doesn't say.) So if you want a reactive document, this doesn't seem like a fit.