Part 04 · Revision sheet

Software Design and Application Architecture

Key Terms

  • Object-oriented design (OOD) — group state with the behavior that protects it; compose by default, inherit only for genuine is-a (→ 43)
  • SOLID — five checkable pressures on a class/module: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion (→ 44)
  • C4 model — four nested zoom levels — context, container, component, code — each answering one audience's question (→ 45)
  • State machine — a fixed set of states and legal transitions; any other transition is rejected, not silently applied (→ 46)
  • Design pattern — a named, reusable solution to a recurring object-collaboration shape (→ 47)
  • Repository — a collection-like interface (findById, save, delete) hiding persistence behind a domain-shaped contract (→ 48)
  • Unit of Work — tracks every change made in one business operation and commits them together, atomically (→ 48)
  • Layered architecture — a fixed stack (presentation/application/domain/infrastructure) where dependencies point only downward (→ 50)
  • Clean architecture — domain at the center of concentric rings; every dependency points inward through interfaces the center defines (→ 51)
  • Hexagonal architecture (ports and adapters) — domain-owned ports; driving and driven adapters plug into them (→ 52)
  • Modular monolith — one deployable with multiple modules, each owning its own tables, exposed only through a defined interface (→ 53)
  • Bounded context — an explicit boundary inside which a model and its ubiquitous language are internally consistent (→ 56)

Decision Rules

  • Prefer composition over inheritance; inherit only for genuine is-a substitutability (→ 43)
  • Apply a SOLID letter only once its matching pain is real, never preemptively (→ 44)
  • Draw a diagram to answer one question at one zoom level; stop before Code level in most cases (→ 45)
  • Add a state machine once an entity has more than two states, or an illegal transition has slipped through (→ 46)
  • Pick the smallest pattern that fits; an if/else beats Strategy + Factory until a third or fourth variant actually arrives (→ 47)
  • Skip Repository when the ORM's own session/change-tracking is already an adequate boundary and test seam (→ 48)
  • Default to layered architecture; reach for hexagonal or clean only when domain complexity earns it; choose a modular monolith for service-grade boundaries without distribution cost (→ 50–53)
  • Write an ADR only when more than one credible option existed with a real, statable cost (→ 57)

Numbers & Formulas

None — this part teaches no standalone numbers or formulas.

Traps

  • Over-abstraction: an interface with one implementation and no test seam — a concrete class is simpler until a second implementation exists (→ 44)
  • Singleton used as a disguised global instead of dependency injection (→ 47)
  • A "leaky" repository whose methods return query-builder objects — callers still depend on the database technology (→ 48)
  • "Clean" architecture in folder names only — the use case imports an ORM base class, breaking the inward dependency rule (→ 51)
  • "Modules" still sharing one database schema with foreign keys crossing boundaries — no real boundary exists despite the module names (→ 53)

Self-Quiz

  1. Can you point to one of your classes and name the exact invariant its encapsulation protects? (no → revisit 43)
  2. Can you look at a class and state which SOLID letter, if any, it is currently straining against? (no → revisit 44)
  3. Can you pick the right C4 zoom level for a given question without defaulting to the most detailed one? (no → revisit 45)
  4. Can you name, for any file in your system, which layer it belongs to and justify what it is allowed to import? (no → revisit 50)
  5. Can you name every module's public interface and show no other module bypasses it? (no → revisit 53)

Search the guide