What is Liskov’s Substitution Principle?
In this article, we will explore the Liskov’s substitution principle, one of the SOLID principles and how to implement it in a Pythonic way. The SOLID principles entail a series of good practices to achieve better-quality software. In case some of you aren’t aware of what SOLID stands for, here it is:
- S: Single responsibility principle
- O: Open/closed principle
- L: Liskov’s substitution principle
- I: Interface segregation principle
- D: Dependency inversion principle
The goal of this article is to implement proper class hierarchies in object-oriented design, by complying with Liskov’s substitution principle.
Liskov’s substitution principle (LSP) states that there is a series of properties that an object type must hold to preserve the