Duration 1:00

Liskov Substitution Principle Tutorial with Example for Software Developer

58 watched
0
3
Published 4 Mar 2023

Liskov Substitution principle is the third principle of SOLID principles. Liskov Substitution principle states that objects of a superclass should be replaceable with objects of its subclasses without breaking the application. The Liskov Substitution principle was introduced by Barbara Liskov in her conference keynote “Data abstraction” in 1987. It extends the Open/Closed principle and enables you to replace objects of a parent class with objects of a subclass without breaking the application. This requires all subclasses to behave in the same way as the parent class. To achieve that, your subclasses need to follow these rules: 1. Don’t implement any stricter validation rules on input parameters than implemented by the parent class. 2. Apply at the least the same rules to all output parameters as applied by the parent class. In simple words, what we want is to have the objects of our subclasses behaving the same way as the objects of our superclass. So, the next time by mistake if you create an object of the subclass instead of super class, you should still be fine considering LSP. An overridden method of a subclass needs to accept the same input parameter values as the method of the superclass. Similar rules apply to the return value of the method. The return value of a method of the subclass needs to comply with the same rules as the return value of the method of the superclass. ** Use of Liskov Substitution Principle ** 1. Use Liskov Substitution want to replace parent object with the child class object. 2. Use Liskov Substitution if you want to reuse code. 3. Use Liskov Substitution if you want reduce software maintenance effort. 4. Use Liskov Substitution principle when you want loose coupling between software components. ** Benefits of Open-Closed Principle ** 1. Liskov Substitution principle gives us a loosely-coupled, flexible set of classes to handle changing requirements. 2. Liskov Substitution principle helps in Code Reusability. 3. Liskov Substitution principle makes software maintainable. 4. Liskov Substitution principle introduces reduced Coupling. ** Topics Covered ** 1. Introduction of Liskov Substitution Principle 2. Real world example of Liskov Substitution Principle 3. Java code implementation of Liskov Substitution Principle 4. Usage of Liskov Substitution Principle 5. Advantage of Liskov Substitution Principle 6. Summary of Liskov Substitution Principle 7. Next Video on Interface Segregation Principle #solidprinciples #liskovsubstitution #liskovsubstitutionprinciple ** GIT Repository ** CodeOneDigest Solid Principles Example https://github.com/codeonedigest/solidprinciples ** CHECK OUT OUR OTHER VIDEOS ** Spring boot project setup: /watch/sxKJe02AgsbAJ Spring Boot Microservice with postgres database Project: /watch/05bEg9Ow4wiwE Prepare Docker file, Container and Build Image: /watch/osunjzTdp_gdn Deploy Docker Image AWS Elastic Container Service: /watch/wzZwuno5RlZ5w Solid Principle Tutorial /watch/EewXfBrZ4d7ZX ** CHECK OUR PLAYLISTS ** Java Design Pattern Complete Tutorial /playlist/PL2NZAYdLkYvglL0xl-4tgBAribrcjeuNH Spring Boot Complete Tutorial /playlist/PL2NZAYdLkYvg_VlNmszrb-Um0wRx5yGDF Docker Containers Complete Tutorial /playlist/PL2NZAYdLkYvhZQo2VTVCSug_zVjekNodi Solid Principles and Object-Oriented Programming Concept and Design /playlist/PL2NZAYdLkYvgB_35bYUnqP1p6v6P2Yb4- ** Acronyms ** OOP – Object Oriented Programming Languages SRP – Single Responsibility Principle OCP – Open Closed Principle LSP – Liskov Substitution Principle ISP – Interface Segregation Principle DIP – Dependency Inversion Principle COD – Code One Digest ** ABOUT OUR CHANNEL ** CodeOneDigest is a youtube channel that produces videos on programming languages, cloud and container technologies, Software design principles, Java frameworks in English and Hindi languages. Check out our channel here: /channel/UC9V0QYsWKz_OD2uooCtEtRg Don’t forget to subscribe! ** OUR WEBSITE ** https://codeonedigest.wordpress.com/ ** GET IN TOUCH ** Email us on codeonedigest@gmail.com FOLLOW US ON SOCIAL - LIKE, SHARE & SUBSCRIBE Get updates or reach out to Get updates on our Social Media Profiles! Subscribe: https://bit.ly/3NeWQ8U Youtube: /channel/UC9V0QYsWKz_OD2uooCtEtRg Twitter: https://twitter.com/codeonedigest Facebook: https://www.facebook.com/codeonedigest Instagram: https://www.instagram.com/codeonedigest/ Linkedin: https://www.linkedin.com/in/codeone-digest-10b418255/ Reddit: https://www.reddit.com/user/codeonedigest Github: https://github.com/codeonedigest Website: https://codeonedigest.wordpress.com/ Tumblr: https://www.tumblr.com/codeonedigest Pinterest: https://in.pinterest.com/codeonedigest/

Category

Show more

Comments - 1