Foundations
Design patterns
Use a pattern to resolve a named source of change.
Understand the problem
Strategy swaps algorithms. Observer distributes change notifications. Factory centralizes creation rules. State models behavior that depends on lifecycle stage.
Make it concrete
A vending machine accepts different actions in idle, paid, and dispensing states.
Trade-offs and pitfalls
Patterns are vocabulary, not a scorecard of how many classes you can introduce.
Check your understanding
Choose a pattern for interchangeable discount policies.
Practice this topic