From dependency injection to dependency rejection
summary
Covers a restaurant-reservation example that splits into five steps (validate, map, check capacity, save, respond), showing dependencies: an integer capacity and two functions readReservations(date) -> Reservation list and createReservation(Reservation) -> int. Shows F# partial application compiling to IL that creates a class with constructor-injected fields (same effect as constructor DI), then refactors to return a Reservation option so saving becomes a separate impure step. Argues that partial application makes impurity contagious, and prefers a impure–pure–impure sandwich via function composition to eliminate mocks and simplify testing.
AI-written summary · about
chapters (13)
- 0:00Start
- 3:33What's Dependency Injection
- 4:11On Line Restaurant Reservation System
- 5:15Validate the Input
- 8:21Domain Objects
- 10:36Constructor Injection
- 21:09Pipe Operator
- 24:09Partial Application
- 31:21Impure Functions
- 43:48Pattern Matching
- 44:58Get Rid of Indirect Input
- 51:33The Earl of Sandwich
- 53:28Functional Programming
