Module 3: Behavioral Patterns
Behavioral design means making collaboration predictable under change. Learn all eleven GoF behavioral patterns, choose simpler alternatives when appropriate, and defend ordering, state, failure and ownership with runnable evidence. No pattern count, reading list or module completion establishes a professional percentile.
This guide is the primary teacher; you do not need to read the source books front-to-back. Use Head First Design Patterns for narrative explanations, Design Patterns (GoF) for intent and collaborations, and Refactoring for incremental changes. See the reading guide for exact local locators and honest book-index links.
Prerequisites and entry
Complete S3 Modules 1–2: callable interfaces, ownership, test doubles, exception traces and bounded behavior-preservation evidence. Start with the prerequisite diagnostic; it tests prior skills, not pattern names you have not learned. Python 3.10+ runs the offline kit. Existing Java/TypeScript snippets are instructional sketches where labeled, not additional toolchain prerequisites.
Learning sequence
Read the 19 core lessons in order, alternating each cluster with its practice route and lab, then complete the four runtime comparison lessons R1–R4 below. Supporting lessons are part of the concept path; optional reading is separate.
Required runtime comparison: R1–R4
The runtime extension retains the other machine's EventBus/Editor work with explicitly different policies:
| Order | Lesson |
|---|---|
| R1 | Delivery contract |
| R2 | Subscription lifecycle |
| R3 | No-op and history contract |
| R4 | Failure and retry boundaries |
Compare both contracts using this table. The combined module therefore has 23 concept lessons, seven core labs and a required two-API comparison package. It does not ask learners to treat incompatible policies as interchangeable implementations of the same API.
The first five clusters cover Strategy/Template Method, Observer, Command, State/FSMs and Iterator/Chain/Visitor. The sixth adds Memento, Mediator, Interpreter and protocol composition. Structural and creational patterns follow in Module 4. Durable messaging, concurrent editors, parser construction and framework-specific reactive streams are later depth work, not claims of these labs.
Practice and evidence path
- Worked examples and behavior contracts.
- P01–P05: variation.
- P06–P10: notification.
- P11–P15: histories and state.
- P16–P20: traversal and coordination.
- Seven guided labs, three experiments, and the bounded project. Reuse artifacts across tasks.
- Independent assessment, then separate feedback and C01–C10 plus BD1–BD6 gates. Practice feedback is separate too.
Outcomes
Explain change pressure and compare at least one simpler alternative. Make interchangeable policy obey a shared contract. Specify subscription identity, mutation and error behavior. Preserve history on rejected edits. Distinguish commands from accepted facts and local undo from external compensation. Model every state/event cell and failure boundary. Demonstrate lazy traversal, deliberate handler stopping and Visitor's extension tradeoff. Use Mediator and Interpreter only when their coordination/language responsibilities justify them.
Workload and completion
| Required work | Focused hours, author estimate |
|---|---|
| Diagnostic, 19 lessons, targeted reading | 28–38 |
| 20 practice tasks | 16–24 |
| Seven offline labs | 24–36 |
| Three experiments | 8–12 |
| Assessment, repairs, delayed recheck | 8–12 |
| Project and defense | 16–23 |
| Core subtotal | 100–145 |
| Runtime comparison: targeted lessons/traces 3–4, implementation 5–8, assessment/repair 2–4 | 10–16 |
| Combined module total | 110–161 |
These estimates await learner pilots. At ten focused hours per week the estimate is roughly 11–17 weeks, not a seven-day promise. Count reused evidence once; record actual time and revise estimates. The incoming runtime package's original standalone 18–26-hour estimate becomes 10–16 additional hours here because core instruction and common trace/assessment work are reused. Do the comparison-specific work once; do not add both estimates. Optional depth work adds time.
Completion requires all C01–C10 and BD1–BD6 at level 2 or above, all seven core labs and the runtime comparison package, three experiments, project defense and a 7–14 day delayed recheck. Keep real errors and repairs; do not manufacture a mistake quota. Authored and executed status is separate from independent technical, assessment, accessibility and learner review. See the instructor guide.
Reference and selective reading
Resources | Reference map | Exercise lanes | Case studies | Mistake clinic