design-principles

    Design Principles Course

    Staff-engineer design principles — clean architecture, distributed systems, reviews, and refactoring mastery.

    97
    Lessons
    14
    Modules
    0/97
    Completed
    Curriculum

    Enterprise learning path

    14 modules · 97 lessons

    Foundations

    0/7 complete
    1. 1
      Design Principles Home
      Next up

      Welcome to Design Principles: From Clean Code to Staff Engineering Excellence — an internal academy for engineers who need maintainable systems, principled code reviews, archite…

    2. 2
      What Are Design Principles?

      Design principles are durable guidelines for structuring code and systems — they describe forces and trade-offs (cohesion, coupling, change isolation) rather than specific reusa…

    3. 3
      Principles vs Patterns

      Principles state enduring forces; patterns are named, reusable solutions to recurring problems.

    4. 4
      Principles vs Rules

      Rules are enforceable constraints (lint, CI, style guides).

    5. 5
      When Principles Matter

      Principles matter most when change cost exceeds abstraction cost — typically after the second use case, when multiple teams touch the same module, or when incidents correlate wi…

    6. 6
      Code Quality Mindset

      Code quality is a business investment — not aesthetics.

    7. 7
      Design Principles Myths

      Common myths — "SOLID always," "more interfaces = better," "DRY means no duplicate lines" — cause over-engineering.

    SOLID Principles

    0/7 complete
    1. 8
      SOLID Overview

      SOLID — five principles from Robert C.

    2. 9
      Single Responsibility Principle

      SRP — a module should have one reason to change: one actor or axis of change drives modifications, not "one method only" literalism.

    3. 10
      Open/Closed Principle

      OCP — software entities should be open for extension (new behavior) but closed for modification (existing tested code stays stable).

    4. 11
      Liskov Substitution Principle

      LSP — subtypes must be substitutable for their base types without breaking client expectations.

    5. 12
      Interface Segregation Principle

      ISP — clients should not depend on methods they don't use.

    6. 13
      Dependency Inversion Principle

      DIP — high-level modules should not depend on low-level details; both depend on abstractions.

    7. 14
      SOLID in Practice

      SOLID in practice means applying letters together with trade-offs — not maximizing interfaces.

    Classic Principles

    0/8 complete
    1. 15
      DRY Principle

      DRY (Don't Repeat Yourself) — every piece of knowledge should have a single, authoritative representation.

    2. 16
      KISS Principle

      KISS — prefer the simplest design that meets requirements.

    3. 17
      YAGNI Principle

      YAGNI — don't build capability for hypothetical futures.

    4. 18
      Separation of Concerns

      SoC — distinct sections of a program should address distinct concerns with minimal overlap.

    5. 19
      Law of Demeter

      LoD — a module should not know the internal details of objects it manipulates.

    6. 20
      Composition Over Inheritance

      Favor composing behaviors over deep inheritance trees — avoids fragile base class and LSP violations.

    7. 21
      Program to Interface

      Depend on abstractions (interfaces, protocols) not concrete classes — enables substitution and testing.

    8. 22
      Principle of Least Astonishment

      Code should behave as readers expect — surprise causes bugs and review friction.

    Quality & Maintainability

    0/8 complete
    1. 23
      High Cohesion, Low Coupling

      High cohesion, low coupling — modules do related work together and depend minimally through stable interfaces.

    2. 24
      Immutability Principle

      Prefer immutable data structures where practical — reduces shared mutable state bugs and simplifies reasoning in concurrent systems.

    3. 25
      Fail Fast

      Detect and report errors at the earliest point — don't propagate invalid state.

    4. 26
      Defensive Programming

      Validate inputs and invariants at boundaries — balance with fail-fast clarity, not silent swallowing.

    5. 27
      Tell, Don't Ask

      Tell objects what to do rather than querying state and deciding externally — keeps behavior encapsulated.

    6. 28
      Information Hiding

      Hide implementation details behind stable interfaces — Parnas's foundational idea behind encapsulation.

    7. 29
      Encapsulation Deep Dive

      Encapsulation bundles data and behavior, controlling access — not merely private fields.

    8. 30
      Pure Functions & Side Effects

      Pure functions same output for same input, no side effects — easier to test and parallelize.

    Architecture Principles

    0/8 complete
    1. 31
      Stable Dependencies

      Depend in the direction of stability — volatile modules depend on stable ones, not vice versa.

    2. 32
      Acyclic Dependencies

      Package dependency graph must be acyclic — cycles prevent build ordering and clear ownership.

    3. 33
      Common Closure Principle

      Classes that change together should be packaged together — reduces release friction.

    4. 34
      Common Reuse Principle

      Don't force clients to depend on things they don't use — package granularity matters.

    5. 35
      Stable Abstractions Principle

      Abstractions should be more stable than implementations they abstract.

    6. 36
      Orthogonality

      Orthogonal components change independently — change in one does not affect others (Pragmatic Programmer).

    7. 37
      Locality of Behavior

      LoB — behavior should live near the code it relates to; balance with DRY at the right level.

    8. 38
      Dependency Management Principles

      Managing third-party and internal dependencies — semver, pinning, and abstraction at boundaries.

    Application & Interview

    0/8 complete
    1. 39
      Applying Principles Daily

      Daily application — principles in every PR, standup refactor note, and tech debt ticket — not a quarterly architecture initiative.

    2. 40
      Principles in Code Review

      Principled code review — comment with smell + principle + suggested refactor — never vague "clean this up."

    3. 41
      Principles in Legacy Code

      Legacy code (Feathers: code without tests) — apply principles incrementally with characterization tests and seams.

    4. 42
      Capstone: Principles Refactor

      Capstone — refactor UserAccountFacade (900 lines, 12 responsibilities) with SRP, DIP, OCP, DRY incrementally.

    5. 43
      Design Principles Interview Framework

      Interview framework — read code, name violations, propose minimal refactor, state trade-offs, connect to tests — in 35 minutes.

    6. 44
      Mock: SOLID Code Review

      Mock SOLID review — practice reviewing a realistic PR with SRP, OCP, LSP, ISP, DIP violations.

    7. 45
      Mock: Principle Trade-offs

      Trade-off mock — when SOLID conflicts with KISS/YAGNI, articulate the decision framework.

    8. 46
      Design Principles Cheat Sheet

      Cheat sheet — quick reference for reviews and interviews.

    Design Principles in Distributed Systems

    0/8 complete
    1. 47
      Idempotency Principles

      Idempotent handlers produce the same outcome when executed multiple times — essential for at-least-once delivery in distributed systems.

    2. 48
      Eventual Consistency Boundaries

      Accept eventual consistency only at explicit boundaries with compensating actions and clear user-facing semantics.

    3. 49
      Saga Orchestration Principles

      Long-running distributed transactions use sagas — orchestrated or choreographed steps with compensating transactions.

    4. 50
      Event-Driven Separation

      Publish domain events at bounded context boundaries — consumers depend on event contracts, not internal models.

    5. 51
      API Contract Principles

      Stable API contracts — versioning, backward compatibility, and consumer-driven contracts at service boundaries.

    6. 52
      Circuit Breaker Resilience

      Fail fast when dependencies are unhealthy — bulkheads and circuit breakers prevent cascade (Release It!, Nygard).

    7. 53
      CAP Theorem in Practice

      CAP — partition tolerance is mandatory; choose consistency vs availability per use case, not globally.

    8. 54
      Microservice Decomposition

      Decompose by bounded context and change isolation — not by technical layer alone.

    Real Enterprise Case Studies

    0/5 complete
    1. 55
      Stripe API Design

      Stripe API design embodies ISP, idempotency, and stable abstractions — developer experience as architecture principle.

    2. 56
      Netflix Engineering Culture

      Netflix — freedom and responsibility — principles in microservices, chaos engineering, and paved-road platforms.

    3. 57
      Google Readability

      Google readability — principle-based review culture scaling to millions of LOC across languages.

    4. 58
      Amazon Operating Model

      Amazon — two-pizza teams, service-oriented architecture, and working backwards from PR/FAQ — organizational principles driving technical boundaries.

    5. 59
      Spotify Squad Model

      Spotify squads — autonomy with alignment — principles for squad boundaries, guilds, and shared infrastructure.

    Architecture Reviews

    0/6 complete
    1. 60
      Architecture Review Process

      Formal architecture review — who attends, artifacts required, outcomes, and escalation paths.

    2. 61
      Review Readiness Checklist

      Come prepared: context, options considered, trade-offs, SLO impact, rollback — not slide-deck theater.

    3. 62
      ADR Writing Mastery

      Architecture Decision Records — context, decision, consequences, status — Michael Nygard format.

    4. 63
      Design Review Facilitation

      Staff engineers facilitate — draw out dissent, timebox, ensure decision owner, capture action items.

    5. 64
      Principle-Based Rubrics

      Score designs against principles: coupling, testability, operability — not checklist patterns.

    6. 65
      Architecture Review Anti-Patterns

      Reviews that fail: no decision owner, bikeshedding, architecture astronautics, missing rollback.

    Legacy Modernization

    0/7 complete
    1. 66
      Strangler Fig Pattern

      Gradually replace legacy by routing traffic to new system at seams — Fowler's strangler fig.

    2. 67
      Characterization Testing

      Tests that capture current behavior before refactor — Feathers' legacy code lifeline.

    3. 68
      Seam Identification

      Find points where behavior can change without editing call sites — object seam, preprocessing seam.

    4. 69
      Incremental Extraction

      Extract one responsibility per PR — trunk-based development with principles.

    5. 70
      Legacy DIP Migration

      Introduce interfaces at boundaries already touched by changes — don't boil the ocean.

    6. 71
      Monolith Decomposition

      Decompose by bounded context and business capability — identify natural seams.

    7. 72
      Migration Rollback Strategy

      Every migration slice needs rollback — feature flags, dual-write parity, reconciliation jobs.

    Design Principles in System Design

    0/7 complete
    1. 73
      URL Shortener Principles

      System design through principles — hashing, collision handling, redirect SLO, cache layers.

    2. 74
      Rate Limiter Principles

      Token bucket vs sliding window — SRP for limit policy vs storage; fail-fast at edge.

    3. 75
      Notification System Principles

      At-least-once delivery, idempotent consumers, ISP for email/SMS/push channels.

    4. 76
      Feed System Principles

      Fan-out on write vs read — trade-off documentation in ADR; eventual consistency at feed boundary.

    5. 77
      Payment System Principles

      Strong consistency for ledger, idempotency, audit trail — immutability and append-only events.

    6. 78
      Chat System Principles

      Ordering, delivery guarantees, presence — separate concerns (SoC) for message vs presence vs history.

    7. 79
      Search System Principles

      Inverted index separation, eventual indexing, DIP between query parser and retrieval.

    AI System Design Principles

    0/6 complete
    1. 80
      LLM Boundary Design

      Treat LLM as non-deterministic dependency — DIP with LLMPort, timeouts, fallbacks, human escalation.

    2. 81
      RAG Architecture Principles

      Retrieval-Augmented Generation — separate retrieval (SRP), generation, and evaluation concerns.

    3. 82
      Prompt Engineering Separation

      Prompts as versioned artifacts — not scattered strings.

    4. 83
      AI Safety Guardrails

      Input/output filters, PII redaction, rate limits — fail-fast on policy violation.

    5. 84
      Evaluation-Driven Design

      Ship AI features with eval harness — golden sets, regression on model/prompt changes.

    6. 85
      Human-in-the-Loop Principles

      High-stakes decisions require human confirmation — principle of least astonishment for users.

    Staff Engineer Leadership Track

    0/6 complete
    1. 86
      Technical Leadership Principles

      Lead through clarity, standards, and multiplied impact — not heroics or gatekeeping.

    2. 87
      Mentoring Through Principles

      Teach smells and refactor moves — not answers.

    3. 88
      Cross Team Standardization

      Standards where divergence hurts (security, observability); autonomy where it helps (domain models).

    4. 89
      Principle-Driven RFCs

      RFCs state forces, options, trade-offs, decision — staff template used org-wide.

    5. 90
      Building Review Culture

      Psychological safety + high standards — reviews teach, don't punish.

    6. 91
      Staff Promotion Narrative

      Promotion case: scope, impact, principles applied at org scale — brag doc with metrics.

    Refactoring Workshops

    0/6 complete
    1. 92
      Workshop: God Class

      God class workshop — 450-line OrderManager: list smells, map to SRP, extract in 4 safe steps with tests.

    2. 93
      Workshop: Dependency Inversion

      DIP workshop — concrete PostgresUserRepository inside UserService — introduce port, fake, wire DI.

    3. 94
      Workshop: Feature Envy

      Feature envy workshop — ReportGenerator reaches into Order line items — move method to Order.

    4. 95
      Workshop: Long Parameter List

      Long parameter list — 12-parameter createUser — introduce parameter object or builder with validation.

    5. 96
      Workshop: Switch Statements

      Switch workshop — discount switch grows weekly — apply OCP with Strategy registry.

    6. 97
      Workshop: Parallel Change

      Parallel change (Expand-Contract) — migrate API shape without breaking clients — Fowler branch by abstraction.