Liskov substitution principle
Also called: LSP
The L in SOLID: a subtype must work everywhere its parent type is expected, without surprising the caller.
Definition
A subtype has to keep the whole contract of its parent: accept at least the same inputs, promise at least the same results, and keep the same rules, including unwritten ones like not throwing for valid input. A subclass that throws "not supported" or changes behavior callers rely on breaks code that was written for the parent.
In practice
A ReadOnlyBackup that implements DocumentStorage but throws in save breaks every caller that archives documents.
Learn it in context
Lessons that use this term.