1.1 Liskov Substitution Principle (LSP) with Solution in Java - SOLID Principles of Low Level Design

preview_player
Показать описание
this is one of the important SOLID principle. And covered its both Problem and Solution

Рекомендации по теме
Комментарии
Автор

Youtube and people like you have made life easier, thankuu.

ankitgoyal
Автор

An excellent explanation of Liskov's Substitution principle. I work primarily with python and javascript, and your explanation really illustrates well why typescript and type hinting in python are necessary to avoid errors.
Thank you very much.

Ricky-jrio
Автор

Best example of Liskov's substitution principle

CanadaKeBhai
Автор

This brings the point when to ditch Inheritance over Composition. Like how Abstraction/Inheritance brings coupling along with itself. Though, both Inheritance and Composition will have it's own pros/cons. Amazing playlist!

nitigya
Автор

One suggestion - hasEngine could have values - true and false. So instead of returning null, we could have returned false, and it would not break.
For this example, we could have taken something like engineType instead of engine. In that case, cycle will have to return null.
PS - I am new to these topics. Please correct me if i am wrong 🙂

anuraggupta
Автор

This is the perfect Explanation of this principle, i watched this principle in paid courses, but this is the perfect explanation

rajugoud
Автор

No one explained like you this solid concept..thanks

SushilChauhan-zq
Автор

Awesome work ! I have been working for a while but you cleared concepts with examples!

ashishgoswami
Автор

The solution proposed seems to be similar to Interface Segregation principle with the only difference being we use classes here instead of interfaces for segregation. Thanks for the explanation.

aishwaryas
Автор

Beautifully explained !!! keep up the good work !!!

SuyashD-cdwr
Автор

One more thing that comes into mind is separation of behaviours. We can set up behaviors as interfaces and select class can implement that interface while the rest need not have to. (Learnt this through an example in Head First Design Patterns) Shreyansh Jain, correct me if I am wrong. With this, we don't have to create more classes.

pavanls
Автор

very nice explanation!
can you also add similar video explanation for all the other principles? This is a rock solid video, I don't think I will forget this easily.

dpynsnyl
Автор

Amazing... thank you for such clear explanation!

shubhammanecr
Автор

Good example to understand. thanks for your efforts

shawkiahmed
Автор

I think there is a slight conceptual mistake in the start of the video.

In the video, you mentioned that for a parent p, and child classes c1, c2, and c3, LSP says that parent *p = new c1should not break the behavior when c1 is replaced by c2, c1 is replaced by c3.
However, my understanding is that for the same scenario, in a code, if you use c1_object.setSomething() or c2_object.setSomething() and if you have a parent object, the code should retain its behavior if you change c1_object with p1_object.

Please correct my understanding if it's wrong.

saiakhil
Автор

Hi Shrayansh,

1) The vehicle class, does it follow a single responsibility principle.
2) What if I return false instead of return null for the bicycle class, does it follow LSP

rohitvathumilli
Автор

In side bicycle u could return false instead of null ... Why returning null .. returning false can solve the problem..

gurupreetsingh
Автор

Can we get the slides that you are sharing in your videos?

himanshukashyap
Автор

Nicely explained with help of example 😊

shashankcool
Автор

Nice information brother 😊 keep sharing

OffRoadEngineerVlogs