Functional Habits
summary
Shows concrete Java 8 code (streams, records, sealed interfaces) and the Vavr library to refactor menu and order logic into composable parts. Demonstrates hand-refactored map and flatMap functions and a reduce for totals, converts imperative mutating loops into pure functions that return new instances to enforce immutability, and replaces raw strings with value objects and sealed types to make illegal states unrepresentable and catch errors at compile time.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 3:56Functional principles rise
- 7:25Reasons for resistance
- 8:49Composition core idea
- 10:14Abstraction over code
- 15:50Map and flatMap explained
- 22:24Type-driven development
- 23:48Value objects prevent errors
- 28:44Algebraic types modeling
- 33:19Immutability benefits
- 37:15Other functional principles
- 39:01Bug reduction benefits
- 40:29Limiting system entropy
- 43:16Functional in mainstream languages
- 44:41Q&A
