Design Principles & Patterns

Intermediate · Roadmap · 15 lessons · 5 groups

The heuristics that keep a design honest as it grows — DRY, KISS, YAGNI, composition over inheritance, coupling and cohesion — the discipline of noticing and fixing a design that's gone bad (code smells, refactoring, test-driven development), and the Gang-of-Four catalog of creational, structural, and behavioral design patterns as the recurring shapes those heuristics produce in practice. Fifteen lessons that assume object-oriented programming and SOLID as a starting point (see software-architect) and go one layer deeper than computer-science's single GoF survey lesson into the patterns themselves.

0%

Not started

Nothing saved yet. Progress is kept in this browser until you sign in.

Start the path

Design principles · 3

Code quality in practice · 2

Creational patterns · 3

Structural patterns · 3

Behavioral patterns · 4

01DRY, KISS, and YAGNIThree heuristics against duplicated logic, needless complexity, and speculative work — what each one actually guards against, and where each gets misapplied.Beginner · 19 min02Separation of Concerns, Coupling, and CohesionWhat a "concern" is, why mixing two of them in one module causes pain later, and coupling and cohesion as the measurable form of the same idea.Beginner · 14 min03Composition Over InheritanceWhy deep inheritance hierarchies get brittle as requirements shift, and the "has-a instead of is-a" fix, worked through the classic Duck example.Beginner · 10 min01Code Smells and RefactoringWhat a code smell actually is — a symptom, not a bug — the classic named smells, and refactoring as disciplined, test-covered structural repair.Beginner · 14 min02Test-Driven DevelopmentThe red-green-refactor cycle, and how writing the test before the code changes the shape of the design you end up with.Beginner · 15 min01Singleton and Factory MethodOne guaranteed instance versus one hidden decision about which concrete class to build — and why Singleton's convenience comes with a real cost.Intermediate · 16 min02Abstract Factory and BuilderA factory that produces matching families of related objects, and building one complex object step by step instead of an 8-argument constructor.Intermediate · 14 min03The Prototype PatternCloning an already-configured object instead of building one from scratch — and the shallow-versus-deep-copy trap that makes cloning riskier than it looks.Intermediate · 8 min01Adapter and FacadeAdapter translates a mismatched interface so existing code keeps working; Facade hides a tangled subsystem behind one simple entry point.Intermediate · 5 min02Decorator and ProxyDecorator and Proxy both wrap an object behind its own interface — Decorator adds behavior at runtime, Proxy controls access to the real thing.Intermediate · 7 min03Composite, Bridge, and FlyweightComposite unifies a tree under one interface, Bridge splits two axes of variation apart, and Flyweight shares identical state across millions of objects.Intermediate · 6 min01Observer and StrategyObserver lets objects subscribe to state changes without knowing each other's types; Strategy swaps an algorithm's implementation behind one shared interface.Intermediate · 7 min02Command and StateCommand turns a request into an object with its own execute and undo; State replaces a sprawling conditional with one class per mode of behavior.Intermediate · 7 min03Template Method and Chain of ResponsibilityTemplate Method fixes an algorithm's skeleton with overridable steps; Chain of Responsibility passes a request along handlers until one handles it.Intermediate · 8 min04Iterator, Mediator, Memento, and VisitorFour more behavioral patterns: collection traversal, centralized object communication, state snapshots for undo, and adding operations without touching classes.Intermediate · 6 min

Design principles

3 lessons

  1. 01 / 03DRY, KISS, and YAGNIThree heuristics against duplicated logic, needless complexity, and speculative work — what each one actually guards against, and where each gets misapplied.19 min
  2. 02 / 03Separation of Concerns, Coupling, and CohesionWhat a "concern" is, why mixing two of them in one module causes pain later, and coupling and cohesion as the measurable form of the same idea.14 min
  3. 03 / 03Composition Over InheritanceWhy deep inheritance hierarchies get brittle as requirements shift, and the "has-a instead of is-a" fix, worked through the classic Duck example.10 min

Code quality in practice

2 lessons

  1. 01 / 02Code Smells and RefactoringWhat a code smell actually is — a symptom, not a bug — the classic named smells, and refactoring as disciplined, test-covered structural repair.14 min
  2. 02 / 02Test-Driven DevelopmentThe red-green-refactor cycle, and how writing the test before the code changes the shape of the design you end up with.15 min

Creational patterns

3 lessons

  1. 01 / 03Singleton and Factory MethodOne guaranteed instance versus one hidden decision about which concrete class to build — and why Singleton's convenience comes with a real cost.16 min
  2. 02 / 03Abstract Factory and BuilderA factory that produces matching families of related objects, and building one complex object step by step instead of an 8-argument constructor.14 min
  3. 03 / 03The Prototype PatternCloning an already-configured object instead of building one from scratch — and the shallow-versus-deep-copy trap that makes cloning riskier than it looks.8 min

Structural patterns

3 lessons

  1. 01 / 03Adapter and FacadeAdapter translates a mismatched interface so existing code keeps working; Facade hides a tangled subsystem behind one simple entry point.5 min
  2. 02 / 03Decorator and ProxyDecorator and Proxy both wrap an object behind its own interface — Decorator adds behavior at runtime, Proxy controls access to the real thing.7 min
  3. 03 / 03Composite, Bridge, and FlyweightComposite unifies a tree under one interface, Bridge splits two axes of variation apart, and Flyweight shares identical state across millions of objects.6 min

Behavioral patterns

4 lessons

  1. 01 / 04Observer and StrategyObserver lets objects subscribe to state changes without knowing each other's types; Strategy swaps an algorithm's implementation behind one shared interface.7 min
  2. 02 / 04Command and StateCommand turns a request into an object with its own execute and undo; State replaces a sprawling conditional with one class per mode of behavior.7 min
  3. 03 / 04Template Method and Chain of ResponsibilityTemplate Method fixes an algorithm's skeleton with overridable steps; Chain of Responsibility passes a request along handlers until one handles it.8 min
  4. 04 / 04Iterator, Mediator, Memento, and VisitorFour more behavioral patterns: collection traversal, centralized object communication, state snapshots for undo, and adding operations without touching classes.6 min
Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark