Learning Resources
This module is populated from the local chunked books in library/raw/semester-03-software-design/books. Use this page as a source map, not as an instruction to read everything.
Source Stack
| Book | Role | How to use it in this module |
|---|---|---|
| Head First Design Patterns | Primary teaching source | Default narrative for Strategy, Observer, Command, Template Method, Iterator, State, and Chain of Responsibility |
| Design Patterns (GoF) | Canonical pattern vocabulary | Reach for it when you want the precise intent, participants, and "known uses" of a pattern |
| Refactoring (Fowler) | "Replace X with Y" moves that produce patterns | Use when you arrive at a pattern by refactoring, not by greenfield design |
| Clean Code (Martin) | Readability and simplicity | Use to push back on over-patterning and keep patterns small |
| Good Code, Bad Code (Hansen) | Engineering judgment | Use when deciding whether a pattern's cost is worth its flexibility |
| OOAD | State machine modeling | Use specifically for the State cluster's FSM concepts |
Resource Map by Cluster
Cluster 1: Strategy and Polymorphic Variation
| Need | Best local chunk | Why |
|---|---|---|
| narrative introduction | HF: Designing the Duck Behaviors | Classic Strategy motivation by a refactor story |
| integrating and testing | HF: Integrating the Duck Behaviors | Shows composition over inheritance in practice |
| first-class pattern vocabulary | HF: Speaking of Design Patterns | Names the concepts used later |
| canonical definition | GoF: Strategy Applicability | Precise "use when" list |
| template method skeleton | HF: Template Method Pattern Defined | Clean statement of the pattern |
| hooks as optional steps | HF: Hooked on Template Method | Good intuition for hook discipline |
| refactor into Strategy | Refactoring: Replace Conditional with Polymorphism (Part 1) | Shows the mechanical move |
Cluster 2: Observer and Event Notification
| Need | Best local chunk | Why |
|---|---|---|
| subject/observer intuition | HF: The Observer Pattern | Strongest narrative introduction |
| loose coupling message | HF: The Power of Loose Coupling | Best explanation of the dependency direction |
| weather-station walkthrough | HF: Power Up the Weather Station | Concrete end-to-end implementation |
| formal collaborations | GoF: Observer Collaborations | Precise shape and responsibilities |
| implementation choices | GoF: Observer Implementation | Weak refs, notification policies, and more |
| pub/sub class diagram | HF: Observer Pattern Class Diagram | Useful when you need the picture in hand |
Cluster 3: Command and Action Encapsulation
| Need | Best local chunk | Why |
|---|---|---|
| first narrative | HF: 6 The Command Pattern | Best initial motivation |
| pattern definition | HF: The Command Pattern Defined | Participants and intent |
| remote control example | HF: Assigning Commands to Slots | Invoker/receiver separation made concrete |
| logging and replay | HF: Logging Requests | Best example of queued/replayable commands |
| canonical vocabulary | GoF: Command Class and Subclasses | Formal roles |
| implementation choices | GoF: Command Implementation | Undo strategies, stateful commands |
| promoting a function | Refactoring: Replace Function with Command | Mechanical move into Command |
| demoting when overkill | Refactoring: Replace Command with Function | Mechanical move out of Command |
Cluster 4: State and Behavior-Switching Patterns
| Need | Best local chunk | Why |
|---|---|---|
| first narrative | HF: 10 The State Pattern | Gumball machine story; the clearest introduction |
| implementation | HF: Implementing Our State Classes | Concrete state classes |
| pattern definition | HF: The State Pattern Defined | Participants and intent |
| consequences | GoF: State Consequences | Best trade-off summary |
| FSM vocabulary | OOAD: FSM -- A Simple Example | Clean state/event/transition framing |
| conditional-to-polymorphism | OOAD: Replacing Event Conditionals with Polymorphism | Refactor move anchored in FSM theory |
| repeated switches smell | Refactoring: Repeated Switches | The smell that triggers the refactor |
| switches and their costs | Clean Code: Switch Statements | Readability angle on the same problem |
Cluster 5: Traversal and Processing Patterns
| Need | Best local chunk | Why |
|---|---|---|
| iterator narrative | HF: 9 The Iterator and Composite Patterns | Clear motivation |
| encapsulating iteration | HF: Can We Encapsulate the Iteration? | The extraction move |
| language integration | HF: Meet Java's Iterable Interface | Useful for seeing how languages expose iterators |
| iterator canonical | GoF: Iterator Implementation | Implementation choices |
| chain of responsibility narrative | HF: Chain of Responsibility | Compact introduction |
| chain canonical | GoF: Chain of Responsibility Implementation | Roles and dispatch choices |
| chain real-world | GoF: Chain of Responsibility Known Uses | Grounding in real systems |
| visitor canonical | GoF: Visitor Applicability | When to pay the ceremony |
| visitor implementation | GoF: Visitor Implementation | Double dispatch in detail |
External Resources (Validated)
Use sparingly; the local chunks come first. Each link below was reachable at the time this module was written and is useful for a quick second-pass view or diagram.
Cluster 1
- Strategy -- refactoring.guru -- clean diagrams and a strong "Strategy vs Command" comparison at the bottom.
- Template Method -- refactoring.guru -- hook discipline and trade-offs.
Cluster 2
- Observer -- refactoring.guru -- publisher/subscriber walkthrough and relations with Mediator.
Cluster 3
- Command -- refactoring.guru -- excellent undo walkthrough and the Memento comparison.
Cluster 4
- State -- refactoring.guru -- canonical audio-player example.
- Finite State Machine -- refactoring.guru -- brief introduction to the theory behind the pattern.
Cluster 5
- Iterator -- refactoring.guru -- includes the social-graph example and relation to Visitor.
- Chain of Responsibility -- refactoring.guru -- GUI-tooltip-bubbling example is worth reading.
- Visitor -- refactoring.guru -- and the supporting Visitor and Double Dispatch article for the mechanism.
Use Rules
- Stuck on intent or naming? Read Head First first. It is the shortest path back on your feet.
- Stuck on precise responsibilities or trade-offs? Read GoF. It is terse but authoritative.
- Arrived at the pattern by refactoring? Go to Refactoring for the mechanical move, not a pattern book.
- Tempted to add a fifth class "just in case"? Read the relevant Clean Code heuristic and reconsider.
- One chunk per one question. Do not wander through a chapter by default.