Level 4 of 7 · about 2 weeks
Patterns II: structure and behaviour
Strategy, observer, state, command, decorator, adapter, facade, template method, chain, composite and iterator, and how to choose between them.
Modules
Core: everyone needs it. Common: most jobs use it. Specialist: optional depth, safe to skip on a first read.
1
Strategy
Swap one way of doing a job for another without touching the caller
Core 6 parts · about 3 hours
2
3
4
Command
Turn a request into an object so it can be queued, logged and undone
Core 6 parts · about 3 hours
5
6
Adapter and facade
Make a mismatched class fit, and hide a busy subsystem behind one door
Core 6 parts · about 3 hours
7
Template method
Fix the steps of an algorithm once and let subclasses fill in the gaps
Common 6 parts · about 2 hours
8
Chain of responsibility
Pass a request along a line of handlers until one deals with it
Common 6 parts · about 2 hours
9
Composite and iterator
Treat a tree and its parts the same way, and walk it without exposing it
Common 6 parts · about 3 hours
10