The five principles

  • S — Single Responsibility: group work that changes for the same reason.
  • O — Open/Closed: support useful extension without destabilizing established behavior.
  • L — Liskov Substitution: replacements must preserve the behavioral contract expected by clients.
  • I — Interface Segregation: do not force clients to depend on capabilities they do not use.
  • D — Dependency Inversion: high-level policy depends on abstractions rather than low-level details.

Applying them with AI

Use the principles as review questions, not instructions to generate a class hierarchy. Ask an assistant to identify change reasons, contract violations, and unnecessary coupling. Reject abstraction added solely to make the code look architectural. A Hugo partial is not an object, so apply the underlying judgment rather than pretending every object-oriented rule maps literally to a template.

Source

Robert C. Martin’s design-principles paper