SOLID Principles

SOLID is a mnemonic for five object-oriented design principles collected and popularized by Robert C. Martin. They are intended to make software easier to understand, maintain, and extend by guiding how classes and modules are factored and how they depend on one another.

In a 2020 post on his Clean Code Blog, Martin restates each principle directly. The Single Responsibility Principle (SRP): “Gather together the things that change for the same reasons. Separate things that change for different reasons.” The Open-Closed Principle (OCP): “A Module should be open for extension but closed for modification.” The Liskov Substitution Principle (LSP): “A program that uses an interface must not be confused by an implementation of that interface.”

The remaining two concern dependencies. The Interface Segregation Principle (ISP): “Keep interfaces small so that users don’t end up depending on things they don’t need.” The Dependency Inversion Principle (DIP): “Depend in the direction of abstraction. High level modules should not depend upon low level details.”

Martin grounds these ideas in older work. In his 2014 post on the Single Responsibility Principle he writes that “each software module should have one and only one reason to change,” and traces the idea to David Parnas’s 1972 paper on module decomposition and Dijkstra’s separation of concerns. He has defended the principles’ continued relevance against critics, arguing they remain essential for writing maintainable software.