Uploaded September 2021 | Updated September 2026, 2 weeks ago
Learn about the Liskov Substitution Principle. This principle urges programmers to write class hierarchies which adhere to the same interface(s).
If you follow the Liskov Substitution Principle, your client code can use any subtype of a given class interchangeably.
As a result, the code will be more decoupled. And your colleagues and your future self will thank you for that :)
Slides:
github.com/musikalkemist/solidforml/blob/main/solidforml/04%20Liskov%20Substitution%20Principle/Liskov%20Substitution%20Principle.pdf
Code:
github.com/musikalkemist/solidforml/blob/main/solidforml/04%20Liskov%20Substitution%20Principle/liskov.py
===============================
Interested in hiring me as a consultant/freelancer?
valeriovelardo.com
Join The Sound Of AI Slack community:
valeriovelardo.com/the-sound-of-ai-community
Connect with Valerio on Linkedin:
linkedin.com/in/valeriovelardo
Follow Valerio on Facebook:
facebook.com/TheSoundOfAI
Follow Valerio on Twitter:
twitter.com/musikalkemist
===============================
Content:
0:00 Intro
0:19 Defining LSP
0:56 LSP benefits
2:18 LSP violation problems
3:51 Spotting LSP violations
4:25 Introducing the Python example
6:31 Where is the LSP violation?
10:50 Refactoring the code
13:15 What's up next?
Learn about the Liskov Substitution Principle. This principle urges programmers to write class hierarchies which adhere to the same interface(s).
If you follow the Liskov Substitution Principle, your client code can use any subtype of a given class interchangeably.
As a result, the code will be more decoupled. And your colleagues and your future self will thank you for that :)
Slides:
github.com/musikalkemist/solidforml/blob/main/solidforml/04%20Liskov%20Substitution%20Principle/Liskov%20Substitution%20Principle.pdf
Code:
github.com/musikalkemist/solidforml/blob/main/solidforml/04%20Liskov%20Substitution%20Principle/liskov.py
===============================
Interested in hiring me as a consultant/freelancer?
valeriovelardo.com
Join The Sound Of AI Slack community:
valeriovelardo.com/the-sound-of-ai-community
Connect with Valerio on Linkedin:
linkedin.com/in/valeriovelardo
Follow Valerio on Facebook:
facebook.com/TheSoundOfAI
Follow Valerio on Twitter:
twitter.com/musikalkemist
===============================
Content:
0:00 Intro
0:19 Defining LSP
0:56 LSP benefits
2:18 LSP violation problems
3:51 Spotting LSP violations
4:25 Introducing the Python example
6:31 Where is the LSP violation?
10:50 Refactoring the code
13:15 What's up next?










