

E101 FC/IS with magnars
13 snips Apr 1, 2025
Magnar Sveen, a seasoned Clojure programmer from Norway, dives into the Functional Core, Imperative Shell (FC/IS) architecture. He explains how this pattern enhances code maintainability by separating business logic from side effects, making 85% of code pure functions. Magnar also shares insights on the importance of Datomic for data management and practical strategies for implementing FC/IS. The discussion touches on the real-world benefits, including improved error handling and REPL-driven development, along with challenges in transitioning to this modern architecture.
AI Snips
Chapters
Transcript
Episode notes
FC/IS: President and Cabinet Analogy
- Magnar Sveen describes the Functional Core, Imperative Shell (FC/IS) pattern using a presidential cabinet analogy.
- The functional core makes pure decisions while the imperative shell executes side-effects like sending emails or DB updates.
Pure Functions in Functional Core
- Pure functions operate only on data inputs and return data outputs without side effects.
- Functional core composed entirely of pure functions guarantees consistent, predictable results for the same inputs.
Imperative Shell as Glue Code
- FC/IS separates side effects to the imperative shell, which acts as glue and data fetcher.
- The shell fetches declared data needs upfront before invoking the functional core with all relevant data.