Show in graph

Software → Software Design

SOLID

A group of five object-oriented design principles for creating maintainable software.

Motivation

SOLID solves the problem of object-oriented code that becomes hard to change because responsibilities, dependencies, and extension points are tangled together.

Where it fits

SOLID belongs to software design. It is most useful after you understand objects, interfaces, composition, inheritance, and polymorphism.

The five principles

  • SRP: keep one reason to change.
  • OCP: extend behavior without rewriting stable code.
  • LSP: subtypes must remain safely substitutable.
  • ISP: avoid forcing clients to depend on unused interface members.
  • DIP: high-level policy should depend on abstractions.

Mental model

SOLID is not a checklist for adding abstractions everywhere. It is a set of pressure-release valves for code that is changing often.

Common mistakes

  • Applying every principle mechanically to simple code.
  • Creating too many interfaces before the design has real variation.
  • Treating SOLID as only about classes instead of change boundaries.