SOLID Principles

No Change
adopt
First Added:June 24, 2026 Updated: July 2, 2026

SOLID Principles. We adopt it under Technique in the garden.

Summary

Key points: is a mnemonic for five object-oriented design principles from Robert C. Martin. Together they reduce coupling, clarify change boundaries, and keep modules testable. We adopt the set as baseline discipline in application code, not as a checklist to apply in one refactor. Start with Single Responsibility Principle and Dependency Inversion Principle where coupling hurts tests or vendor swaps.

Details

The Five Principles (Short Form)

PrincipleOne-line gist
Single ResponsibilityOne reason to change per module
Open/ClosedOpen for extension, closed for modification
Liskov SubstitutionSubtypes must honor the base contract
Interface SegregationMany small interfaces beat one fat interface
Dependency InversionDepend on abstractions, not concretions

Application Order (Practical)

  1. SRP first: split mixed concerns so each unit has a clear job.
  2. DIP next: introduce ports where tests or vendors force seams.
  3. OCP / LSP / ISP when extension points, inheritance, or interface bloat show up in review.

Common Failure Modes

  • Renaming a god class without splitting responsibilities (SRP violation remains)
  • Interface-per-class with no consumer need (fake DIP)
  • Subclasses that weaken preconditions or strengthen postconditions (LSP violation)
  • “SOLID refactor” that delays delivery without a coupling metric

Related Garden Items