The Rabbit Hole: The Definitive Developer's Podcast

166. SOLID - Liskov Substitution Principle

07.28.2020 - By Stride NYCPlay

Download our free app to listen on your phone

Download on the App StoreGet it on Google Play

For those of you who have been waiting for the next letter of the SOLID series, we are happy to finally discuss the 'L' in SOLID, which is the Liskov substitution principle, or as we like to call it, the LSP. If you’re like us and the LSP conjures up an image of a long-gone mathematician, think again. It is actually a principle developed by Barbara Liskov, an American computer scientist. In this episode, we get into a simple definition of the LSP, which is that objects should be replaceable with their sub-types, and this should not alter the functioning of the program. To clarify, we use an example of shapes in a program and how the principle would be applied. We also look at how the LSP relates to inheritance, and why inheritance should only be used in certain circumstances. Along with this, we touch on our feelings about interfaces and learn more about William’s experience with TypeScript. Tune in today!

More episodes from The Rabbit Hole: The Definitive Developer's Podcast