Design Patterns: Liskov Substitution Principle Explained Practically in C# (The L in SOLID)
- Published on: Sunday, April 8, 2018
- When you are writing code, are you doing it right? That is a question that worries a lot of people, and it should probably at least be something every developer thinks through. Design patterns are best-practice concepts that we can implement into our code to make it better in some way. Think of them as guardrails that keep our code safe. In this video, we are going to look at the third entry in the famous SOLID principle. The L stands for the Liskov Substitution Principle. We are going to dive into what it means, how it should change our programming practices, and how far we should take it.
Newsletter signup (with exclusive discounts): https://signup.iamtimcorey.com/ (your email will be kept safe and you will not be spammed).
Source Code: https://leadmagnets.app/?Resource=LInSOLID
0:00 - Intro
1:32 - Demo code overview
3:04 - Liskov Substitution Principle: LSP Explained...
6:15 - Side note: Covariance and Contravariance, Preconditions Postconditions
10:17 - ...LSP Explained
13:58 - Considering the Open and close principle
17:24 - Implementing LSP: Refactoring demo code
29:23 - Note on abstraction in base classes
33:02 - Flexibility with LSP and Concluding remarks
- Source: https://youtu.be/-3UXq2krhyw