Skip to main content

Module 5: Applied Design & Code Review

Primary texts: Clean Code, Good Code, Bad Code, Refactoring (Fowler) Selective support: Head First Design Patterns for pattern combinations, Design Patterns (GoF) for vocabulary, OOAD for diagrams, plus external material on code review (Google eng-practices) and architecture decision records

This guide is the primary teacher. You do not need to read the source books front-to-back to complete this module. You do need to become operationally strong at choosing patterns under real pressure, reviewing someone else's code, writing design documents, and making tradeoffs that will not be thrown away next week.


Scope of This Module

This module is not a second tour of pattern names. It is the module where pattern knowledge, refactoring mechanics, and basic OOD start being used together, in front of other engineers, with stakes.

What it covers in depth:

  • recognizing the design pressure that justifies a pattern instead of applying patterns for taste or fashion
  • combining multiple patterns (Decorator, Strategy, Factory) cleanly in one feature without pattern salad
  • the four rules of simple design and how they drive day-to-day judgment
  • running a structured code review on correctness, clarity, design, and tests
  • writing specific, evidence-based review comments and receiving feedback without ego damage
  • writing Architecture Decision Records (ADRs) and small design documents that actually get read
  • when a picture (sequence diagram, C4 diagram) earns its keep and when it does not
  • detecting over-engineering and under-engineering by reading the context, not by instinct
  • designing for testability without forcing the domain into an unnatural shape
  • reversibility: distinguishing one-way doors from two-way doors in design decisions
  • reviewable commits, pull-request shape, and automated checks as part of hygiene
  • long-term stewardship: boy-scout rule, broken windows, and a readable Git history

What it deliberately does not try to finish here:

  • full systems architecture and distributed-system design (Semester 4+)
  • enterprise-scale design review governance and architecture review boards
  • team leadership, hiring, and performance conversations beyond review tone
  • advanced formal methods for specification

This is an applied, judgment-heavy module. If you can name patterns and refactors but cannot justify a design choice in front of a skeptical reviewer, you are not done.


Before You Start

Answer these closed-book before starting the main path:

  1. When is "use a pattern" actually bad advice?
  2. What should a useful code review comment contain besides an opinion?
  3. What belongs in a one-page design document that does not belong in code comments?
  4. Name one design decision that is a one-way door and one that is a two-way door.
  5. What is the difference between a nit and a substantive review comment?

Diagnostic Interpretation

4-5 solid answers

  • You are ready for the full path.

2-3 solid answers

  • Continue, but expect extra time in the review and tradeoffs clusters.

0-1 solid answers

  • Revisit Modules 1-4 first. This module assumes you can already name smells, apply Fowler moves, and recognize the core patterns.

What This Module Is For

Applied design shows up every time you are asked questions like:

  • is this code good enough to merge, or does it need another pass?
  • which pattern, if any, is carrying its weight in this feature?
  • how do I explain to a teammate why I changed their abstraction?
  • what should go in the design document so that the next engineer understands the decision?
  • when is a quick, slightly ugly implementation better than a clean but speculative one?
  • how do I tell whether this decision is reversible next quarter?

This module builds the professional judgment needed for:

  • production code review on a team
  • writing proposals and ADRs for non-trivial features
  • leading small design discussions without becoming the bottleneck
  • keeping a codebase livable over months and years

You are learning to ship design, not to recite it.


Concept Map


How To Use This Module

Work in order. The later clusters assume you already have review instincts and ADR habits from the earlier ones.

Cluster 1: Integrating Patterns in Real Systems

OrderConceptTypeFocus
1Choosing Patterns as a Response to Design PressurePRIMARYPatterns solve pressure, not aesthetics
2Combining Patterns: Decorator + Strategy + Factory in One FeaturePRIMARYLayering patterns without salad
3Simple Design: The Four RulesPRIMARYPass tests, reveal intent, no duplication, fewest elements

Cluster mastery check: Can you describe the pressure a pattern solves before you name the pattern?

Cluster 2: Code Review as a Design Conversation

OrderConceptTypeFocus
4Code Review Rubrics: Correctness, Clarity, Design, TestsPRIMARYA structured lens for every review
5Writing Review Comments: Specific, Constructive, Evidence-BasedPRIMARYHow to leave comments that get acted on
6Receiving Feedback: Disagreement, Defense, and GrowthSUPPORTINGSeparating your code from your identity

Cluster mastery check: Can you leave three useful review comments on a real PR without any of them being "nit" or "rename this"?

Cluster 3: Design Documents and Decision Records

OrderConceptTypeFocus
7Architecture Decision Records (ADRs): Format and PurposePRIMARYRecording the why of a decision
8Design Documents for Small-to-Medium FeaturesPRIMARYOne-pager that answers what, why, alternatives, risk
9Sequence Diagrams, C4 Model, and When a Picture Pays for ItselfSUPPORTINGVisual budgets for clarity, not decoration

Cluster mastery check: Can you produce a one-page ADR that a teammate six months from now could understand without you in the room?

Cluster 4: Pragmatic Tradeoffs

OrderConceptTypeFocus
10Over-Engineering vs Under-Engineering: Reading the ContextPRIMARYWhy the right answer depends on the situation
11Designing for Testability without Damaging the DomainPRIMARYSeams without leaking test goo into production
12Reversibility: One-Way vs Two-Way DoorsSUPPORTINGCost-of-reversal as a first-class design lens

Cluster mastery check: Can you look at a proposal and label each decision as reversible or not, and as under/over/appropriately engineered?

Cluster 5: Review Workflows and Craftsmanship

OrderConceptTypeFocus
13Reviewable Commits and Pull-Request ShapePRIMARYMaking a PR easy to review without punishing anyone
14Automated Checks as Part of Design HygieneSUPPORTINGLint, format, and tests as the humane minimum
15Long-Term Code Stewardship: Boy-Scout Rule, Broken Windows, Narrative HistoryPRIMARYKeeping the codebase livable for years

Cluster mastery check: Can you look at a commit history and tell a story about the feature, or is it noise?

Then work these practice pages:

OrderPractice pathFocus
1Pattern Integration LabBuilding one real feature that needs several patterns together
2Code Review WorkshopReviewing provided code samples, writing review comments
3Design Documentation ClinicWriting an ADR, a mini design doc, and a sequence diagram
4Code KatasShort, focused review and refactoring drills

Use Module Quiz after the concept and practice path. Use Reference and Selective Reading and Learning Resources only for targeted reinforcement.


Learning Objectives

By the end of this module you should be able to:

  1. Justify a pattern choice in terms of concrete design pressure, not fashion.
  2. Combine multiple patterns in one feature without creating pattern salad or accidental complexity.
  3. Apply the four rules of simple design to ordinary refactoring decisions.
  4. Run a structured code review using a rubric of correctness, clarity, design, and tests.
  5. Write review comments that are specific, constructive, and evidence-based, and receive feedback without defensiveness.
  6. Write a one-page ADR and a small design document, choosing the right visual aid when one is warranted.
  7. Read context well enough to tell over-engineering from under-engineering and design for testability without deforming the domain.
  8. Distinguish reversible decisions from irreversible ones and shape risk accordingly.
  9. Produce reviewable commits, pull-request descriptions, and a Git history that tells a coherent story.
  10. Use automated checks (lint, format, tests) as background hygiene, not as a substitute for thinking.

Outputs

  • one pattern-integration feature in a language of your choice that uses at least three patterns together and passes characterization tests
  • one code-review workshop file with at least 12 written review comments, each labeled correctness/clarity/design/test and nit/substantive
  • at least 2 ADRs in the standard Context/Decision/Consequences format
  • one design document for a feature you are building this semester (the semester project is fine)
  • one sequence diagram or C4 container diagram for a real system you work in
  • one commit-history rewrite exercise: take a messy branch and reshape it into a narrative history
  • one mistake log naming at least 10 real judgment errors such as patterned before I had pressure, nitpicked instead of discussing design, ADR with no alternatives, test-only public method, or irreversible decision made in a sprint
  • one short memo explaining how this module's habits should carry into Semester 4 and beyond

Completion Standard

You have completed Module 5 when all of these are true:

  • you can explain which pressure a pattern is absorbing before you name the pattern
  • you can compose several patterns in one feature without accidental duplication
  • you can review a 300-line PR and produce useful comments across all four rubric dimensions
  • you can receive a disagreeing review and respond with evidence, not ego
  • you can write a one-page ADR that a stranger can understand six months from now
  • you can read a design and tell whether it is over-engineered, under-engineered, or appropriate
  • you can describe at least three specific testability seams without testifying the production API
  • you can split work into reviewable commits and write a PR description that saves the reviewer time
  • you can tell whether a decision is a one-way or two-way door and scope the analysis accordingly

If you can produce these artifacts but cannot defend the choices verbally, the module is not complete.


Reading Policy

  • Concept pages are the main path.
  • Book chunks are selective reinforcement, not a second syllabus.
  • External links (Google eng-practices, ADR repository, Michael Lynch's review series) are small, focused, and validated.
  • Read only if stuck means try the concept page, write a draft review/ADR, and compare against a rubric first.
  • Optional deep dive means additional nuance or additional patterns, not required progression.

Suggested Weekly Flow

DayWork
1Concepts 1-3 and one pattern-integration sketch
2Concepts 4-6 and review exercises on one provided sample
3Concepts 7-9 and one full ADR plus one mini design doc
4Concepts 10-12 and a tradeoff memo on a real decision
5Concepts 13-15 and a commit-history rewrite
6Practice 1 and 2
7Practice 3 and 4, quiz, mistake-log cleanup

Reference

If you need exact links into the local chunked books, use Reference and Selective Reading.


Rich Learning Pages

Worked Examples | Guided Labs | Case Studies | Mistake Clinic | Reading Guide | Capstone Thread