SOLID
"Five design principles (single responsibility, open–closed, Liskov substitution, interface segregation and dependency inversion) meant together to keep object-oriented code understandable and changeable."
"Five design principles (single responsibility, open–closed, Liskov substitution, interface segregation and dependency inversion) meant together to keep object-oriented code understandable and changeable."
Not one rule but a checklist of five, each naming a different way a class can become hard to change: doing too many jobs, having to be edited to be extended, breaking its parent's promises, forcing callers to depend on what they don't use, and wiring itself directly to the details it should be insulated from.
Rated Heuristic: a dependable rule of thumb, not a proven theorem. The other 224.
Each principle attacks a different source of the same failure: a change in one place forcing changes in another. Single responsibility limits how many reasons a class has to change at all. Open–closed pushes new behaviour into new code rather than edits to old. Liskov substitution keeps a subtype honest so callers need not know which one they hold. Interface segregation stops a client depending on methods it never calls, so changes to those methods cannot reach it. Dependency inversion points both high-level and low-level code at an abstraction between them, so the concrete detail can be swapped without touching the policy above it. Taken together they trade a larger number of smaller parts for fewer forced edits.
It is the most widely taught design curriculum in object-oriented programming, the framing behind most code-review vocabulary in that world, and the reason a generation of interviews ask what the letters stand for. Its value is less in any one of the five than in being a short, memorable inventory of the ways coupling creeps in.
The principles are stated for class-based object orientation and transfer unevenly: in functional or data-oriented code several of them either dissolve or are satisfied by construction. Applied maximally they produce the fragmentation they were meant to prevent: a system of many tiny classes and interfaces in which no single file explains anything, which practitioners have criticised for years. And 'one reason to change' is not decidable from the code: what counts as one reason depends on what the business does next, which the designer does not know.
SOLID is a mnemonic, not a specification, and it was assembled after the fact — Martin did not set out to write five principles beginning with those letters, and Feathers reordered them to spell the word. Nor is it a measure of code quality: code can satisfy all five and be unreadable, or violate several and be perfectly maintainable.
Real as a rule of thumb, not as a theorem. SOLID is rated Heuristic here: dependable enough to plan with, and with no proof behind it.
Rated from two sources. 225 of the 1,116 entries carry this rating. How the scale works.
The best-known laws are the least likely to rest on measurement.
The five principles were collected by Robert C. Martin in his 2000 paper "Design Principles and Design Patterns", written about software rot; several had circulated individually before that, and the Liskov substitution principle is older still. Michael Feathers coined the SOLID acronym around 2004 by reordering them.
Everything above traces to web.archive.org and en.wikipedia.org, two sources in all, one of them the original publication rather than an account of it. Nothing is written from memory, and the method is written down. Spot an error or a better source? Suggest a fix.