Understand the design philosophy of async control flow
masterThe library is built on the principle that managing asynchronous task flow is equivalent to managing a state machine. To handle async flows effectively, you need three components:
- Retained State: Data describing the current progress of the flow.
- Events: Triggers (FSM triggers) that announce when something has happened or failed.
- Transition Rules: A set of rules that define how the application state transitions and what further activity is triggered when events arrive.
Unlike approaches like redux-saga which encode state machines into imperative code (using generators), re-frame-async-flow-fx adopts a data-driven approach. This follows the Clojure preference for "programming in data," allowing for more complex state machines (including failure states and cascades) to be managed via data tables rather than messy, nested imperative logic.