Tech Terms Explained Open in the app →

SOLID

Architecture · Intermediate · 5 min read

What is it?

SOLID is a set of five object-oriented design principles meant to make software easier to understand, change, and extend.

Explain like I'm 5

SOLID is like five rules of tidiness for code: keep each thing focused, easy to add to without breaking, and simple to swap out — so the codebase stays livable.

Why was it created?

Poorly structured code becomes rigid and fragile as it grows. SOLID was popularized to guide designs that resist that decay.

Where is it used?

  • Object-oriented design
  • Code reviews
  • Refactoring decisions
  • Architecting maintainable systems

Why should developers care?

SOLID is common vocabulary in code reviews and interviews, and the principles genuinely help keep large codebases maintainable.

How does it work?

The five principles are: Single Responsibility (one reason to change), Open/Closed (open to extension, closed to modification), Liskov Substitution (subtypes work where their base type is expected), Interface Segregation (small focused interfaces), and Dependency Inversion (depend on abstractions, not concrete details).

Real-world example

Following Single Responsibility, you split a class that both formats and emails reports into two focused classes, so changing the email logic doesn't risk the formatting.

Common use cases

  • Designing maintainable classes
  • Guiding refactors
  • Reducing coupling
  • Improving testability

Advantages

  • More maintainable code
  • Lower coupling
  • Easier to extend and test
  • Shared design vocabulary

Disadvantages

  • Can be over-applied, adding needless abstraction
  • Principles are guidelines, not rules
  • Easy to misinterpret
  • Overkill for tiny code

When should you use it?

When designing or refactoring object-oriented code you expect to grow and change.

When should you avoid it?

For small, stable scripts where rigorous structure adds more ceremony than value.

Alternatives

Simpler heuristics (KISS, YAGNI)Functional design principles

Related terms

Design PatternsDependency InjectionMVCRefactoring

Interview questions

Beginner

  • What does SOLID stand for at a high level?
  • What is Single Responsibility?

Intermediate

  • Explain the Open/Closed principle.
  • What is Dependency Inversion?

Senior

  • When can applying SOLID cause over-engineering?
  • How does Dependency Inversion aid testing?

Common misconceptions

  • "SOLID is mandatory everywhere" — they're guidelines; applied blindly they can over-complicate code.
  • "SOLID guarantees good design" — they help, but judgment and simplicity still matter most.

Fun facts

  • SOLID is an acronym of five separate principles.
  • The principles were collected and popularized by Robert C. Martin (Uncle Bob).

Timeline

  • 2000s — The SOLID acronym is popularized

Learning resources

Quick summary

SOLID is five object-oriented design principles that reduce coupling and keep code maintainable, extensible, and testable.

Cheat sheet

  • 5 OOP design principles
  • Single Responsibility, Open/Closed, Liskov, Interface Segregation, Dependency Inversion
  • Reduce coupling
  • Guidelines, not absolute rules

If you remember only one thing

SOLID is five guidelines for object-oriented design that keep code easy to change without breaking things.