Clean up state handling with a state machine
summary
Retrofits a state machine into a growing ride app, replacing a monolithic ride model with a sealed class hierarchy for states and actions as a generic abstract class, using RxJava BehaviorSubject as the single source of truth. Migration happens incrementally with coexistence callbacks to avoid big bangs, every ride API operation becomes an action, the old ride repository is removed, migration ships in small PRs with no crash or failure-rate increase, and follow-up features like caching require only a few lines.
AI-written summary · about
chapters (5)
- 0:00Introduction to state machine
- 4:21Problems with current state handling
- 7:28Designing the state machine solution
- 13:30Incremental migration challenges
- 18:01Outcomes and takeaways
related talks
20mSubjecting State to Good Behavior
41mManaging State in Angular Applications
35mRxJS destroy the state machine
30mReactive State Machine
26mRxJS: destroy the state machine!
28mApplying Rx Best Practices to Your Architecture
26mSingle activity navigation so simple even I can understand it
29mGrox: a library to manage the state of Java / Android apps
