State Machine in Elixir with Machinery
summary
State machines start simple and balloon into tangled logic across models, controllers and UIs; the concrete fix shown is an Elixir library called Machinery that models states, transitions, guards and callbacks on plain data (no extra processes), plugs into Phoenix visualizer for a Trello-like board, and already registers 5,500 downloads. Example: shopping-cart flow with stock checks, item locking/unlocking and payment guards implemented as declared transitions that run before/after hooks — a practical, working replacement for ad hoc Trello-based wiring.
AI-written summary · about
chapters (10)
- 0:00Introduction and welcome
- 1:16Why state machines matter
- 8:37What is a state machine
- 15:40State machines in real software
- 19:57Elixir and functional programming
- 23:07Existing state machine solutions
- 26:19Introducing Machinery
- 29:08Shopping cart example with Machinery
- 30:33Visual interface for state machines
- 32:39Key takeaways and conclusion
related talks
46mState Machines (The Good, The Bad and The Ugly)
30mA short tale about state machine
25mState Machines
28mState Machines
41mWhat If We Implemented a State Machine to Help the Little Mouse?
36mState-machine Driven Payment Flow
41mKnowing your state machines
36mFunctional State Machines in Rust: Typestate and Newtype Patterns
