G o F Patterns
summary
Argues that many GoF behavioral patterns are workarounds for missing higher order functions and rewrites them with Java 8 lambdas and the Stream API and Optional. Builds runnable examples: command as Runnable lambdas, template as a loan pattern taking a Consumer, decorator as function composition, chain of responsibility via streaming Optional results, interpreter using a map of binary operators (example RPN run yields 12). All functional versions produce the same outputs and simplify control flow and resource management.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 0:48OO design patterns critique
- 3:40Command pattern rewritten
- 7:38Internal vs external iteration
- 12:53Strategy pattern functionally
- 13:35Template pattern with lambdas
- 17:53Observer as functional consumer
- 18:15Decorator with function composition
- 23:21Tax calculation chaining
- 27:00Chain of Responsibility functionally
- 36:58Interpreter pattern for reverse Polish notation
- 42:30Visitor replaced by pattern matching
- 49:09Q&A








