What if We Implemented a State Machine from Scratch to Help the Little Mouse?
summary
A from-scratch state machine implemented in Java with a plain-Java core and a Spring wrapper models a tooth-for-money workflow (tooth received → verify → request money → wait → deliver → finish). It includes an Engine class for launch/relaunch, a ProcessExecutionContext that records step history for a dashboard, MongoDB persistence for runtime visibility, conditional/prioritized transitions, async pause and retry of a failed step, and the code is available on GitHub.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 3:11What is a state machine
- 8:06Spaghetti code problem
- 16:15Creating states and transitions
- 22:45Process visibility and control
- 27:30Process history and persistence
- 33:11Handling conditions and async
- 36:03Adding a new step
- 38:53Failure handling and retries
- 41:23Summary and implementation benefits
- 42:45Alternatives and conclusion
related talks
41mWhat If We Implemented a State Machine to Help the Little Mouse?
37mKnowing your state machines
28mState machines for frontend state management
43m.NET: State Machine in Practice
19mIntroducing state machines and statecharts
38mState of the Art Web User Interfaces with State Machines
33mThe Rise of the State Machines
28msetState Machine
