You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the statement that state machine transitions are neither functional or imperative, they can also be both. We distinguish commands and events. Commands drive state machines and events are emitted by them and reflect what has happened. Commands can be side effecting and emit an event. An event is then applied to a state to yield another state and has no side effects ie it is a pure function. This is useful when event sourcing to reconstitute state as events can be replayed without side effects.
Thanks for writing these notes.
On the statement that state machine transitions are neither functional or imperative, they can also be both. We distinguish commands and events. Commands drive state machines and events are emitted by them and reflect what has happened. Commands can be side effecting and emit an event. An event is then applied to a state to yield another state and has no side effects ie it is a pure function. This is useful when event sourcing to reconstitute state as events can be replayed without side effects.
Here’s a blog I wrote on this topic a while back: http://christopherhunt-software.blogspot.com/2021/02/event-driven-finite-state-machines.html
Here’s an implementation of what the blog describes using Rust: http://christopherhunt-software.blogspot.com/2021/02/event-driven-finite-state-machines.html
I’d be interested in your thoughts regarding what we’ve done. Thanks again for your work.
The text was updated successfully, but these errors were encountered: