Pre-req: Functional core, imperative shell
Pre-req: Side-effects, purity, referential transparency
- The functional core is more testable and more composable than the imperative shell or effectful code
- Extending the functional core means making a bigger part of the software pure
- Side-effects can in some cases easily be lifted out from a function, creating a more composable and testable unit
- But sometimes, side-effects are tangled in business logic
- Some side-effects can be delayed until end of request (e.g., updating user's name in database; exception at failure can still be thrown)
- Example: Create dummy users