© Matthias Noback 2018
Matthias NobackPrinciples of Package Designhttps://doi.org/10.1007/978-1-4842-4119-6_3

3. The Liskov Substitution Principle

Matthias Noback1 
(1)
Zeist, The Netherlands
 
The Liskov Substitution principle can be stated as1:

Derived classes must be substitutable for their base classes.

The funny thing about this principle is that it has the name of a person in it: Liskov. This is because the principle was first stated (using different wording) by Barbara Liskov. But otherwise, there are no surprises here; no big conceptual leaps. It seems only logical that derived classes, or “subclasses” as they are usually called, should be substitutable for their base, or “parent” classes. But of course there’s more to it. This principle is ...

Get Principles of Package Design: Creating Reusable Software Components now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.