What is Liskov Substitution Principle ?

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 61

  • @happymalyo_
    @happymalyo_ Год назад +14

    Your tutorial is incredibly clear and well-organized! Keep creating more video like this

    • @interviewhappy
      @interviewhappy  Год назад +2

      Thanks buddy and all the best for your career.

  • @ankitaburman5406
    @ankitaburman5406 Год назад +6

    Excellent Explaination Sir. Thank you so much for videos on Solid Principles

    • @interviewhappy
      @interviewhappy  Год назад

      Thanks Ankita and all the best for your career.

  • @nathanyt
    @nathanyt Год назад +2

    A better example would be something like this:
    - You have a function that accepts an Employee object ---- *void CalcSalary(Employee e) { e.CalculateSalary() }*
    - If you are following LSP, if I pass a subclass object to that function, the program should sill work. Example: *CalcSalary(new PermanentEmployee())*

  • @nayankulkarni5131
    @nayankulkarni5131 7 месяцев назад

    What a absolute simple explaination!

  • @rasalshukla4046
    @rasalshukla4046 Месяц назад +1

    Wow wow wow in 7 min you have solved my confusion

  • @manishackadam
    @manishackadam 9 месяцев назад +1

    Awesome!! understood n will remain permanent in my memory

  • @aneesmohammed7978
    @aneesmohammed7978 2 месяца назад

    Hi. Superb explanation. You have explained in clarity and simple words which I hardly found from others

  • @adventurer2395
    @adventurer2395 10 месяцев назад +4

    this is a better example of interface segregation than LSP

  • @chandusrinivas7813
    @chandusrinivas7813 8 месяцев назад

    Wow, very simple and best example, Great explanation.
    Thanks Bro.

  • @anooprawat1006
    @anooprawat1006 Год назад +8

    What if you return 0 bonus, instead of throwing exception?, Does it fix Liskov ?

    • @prakash13565
      @prakash13565 2 месяца назад

      no it will not as you are breaking the functionality here. See for caluclating a salary we have a particular formula same for bonus and that method will be defined in the parent class. Here in the video he said he is not caluclating just returning the values it means formula will be same for all the employees. But in case for contract employe we cant give bonus and we have to redefine the defination of that bonus method which is wrong.

  • @ijaztufail8000
    @ijaztufail8000 Год назад +4

    Very good sir keep it up. You are explaining at its best. Please upload repository patterns series after this series

    • @interviewhappy
      @interviewhappy  Год назад

      Thanks @ ijaz Will try to do it.

    • @ijaztufail8000
      @ijaztufail8000 Год назад

      @@interviewhappy Welcome. And one more thing please make videos on some programmatic/written questions for experienced developer like in SQL and C# LINQ or other type of test questions

  • @Gauravkumar-jm4ve
    @Gauravkumar-jm4ve Год назад +1

    Very good pls upload more, thanks so much for sharing ur valuable knowledge

    • @interviewhappy
      @interviewhappy  Год назад

      Thanks Gaurav and all the best for your career.

  • @srinivastirri9799
    @srinivastirri9799 12 дней назад

    Excellent neat and clean explanation

  • @shenth27
    @shenth27 6 месяцев назад +2

    This example violates LSP because you're throwing NotImplementedException but you can instead returns 0 bonus for ContractualEmplyeee and avoid the error.

    • @visarad
      @visarad 6 месяцев назад

      same question

    • @surajmangalekar4370
      @surajmangalekar4370 5 месяцев назад +3

      0 has a value, business perspective we should not provide anything for contract employees

    • @akdigitalmedialive
      @akdigitalmedialive 4 месяца назад

      Returning 0 means there is salary component bonus which is wrong. Also think about maintaining this method in long term

  • @sanmathi3968
    @sanmathi3968 9 месяцев назад

    Awesome. Really helped. Please create videos for design patterns 😊

  • @haidernaqvi87
    @haidernaqvi87 Год назад +1

    It is somewhat similar to interface segregation principle. Because contractaul employee were forced to implement bonus method which it doesn’t need

  • @gawnsj
    @gawnsj Месяц назад

    So we just need to move calculateBonus inside permanentEmployee class right?

  • @na2599
    @na2599 2 месяца назад

    we can say that LSP is same as Interface segragation Principal?

  • @khilanunadkat3865
    @khilanunadkat3865 Год назад +1

    Excellent explanation. Thank you

    • @interviewhappy
      @interviewhappy  Год назад

      Thanks. Glad you liked it. Wish you all the best for your career.

  • @chirasreepal2672
    @chirasreepal2672 4 месяца назад

    simple and clear explanation :)

  • @sweetu246
    @sweetu246 5 месяцев назад

    Sir ,Videos really helped me to understand the concepts,Please create azure tutorial as well

  • @MuhammadKashif-wh1us
    @MuhammadKashif-wh1us Год назад

    just one word : Thanks

  • @anandafit6
    @anandafit6 7 месяцев назад

    what are the practical scenarios we need to replace supertype from subtypes?

  • @User-Dotnet
    @User-Dotnet 3 месяца назад

    What will happen if we not Override Bonus Method in ContractualEmployee Class? What will happen if we declare only Calculate salary because Bonus method already override in PermanentEmploye Class right!

  • @rktamilarasi2442
    @rktamilarasi2442 7 месяцев назад

    I have one doubt
    We can't use the CalculateBonus() method in ContractualEmployee class but it is basically have the method of CalculateBonus() through inheritance.
    Then my question is how to use CalculateBonus () method in ContractualEmployee class and ContractualEmployee class object?

  • @muhammadadil7307
    @muhammadadil7307 3 месяца назад

    Sir its humble request plz make video on deep and shallow copy

  • @S-yf5te
    @S-yf5te 11 месяцев назад

    The above example is for bad design how to fix it?

  • @mayankpriyadarshi9346
    @mayankpriyadarshi9346 4 месяца назад

    I am confused you have created object of pEmployee.calculateBonous and saying this follow LSP. Help me to correct if CalculateBonous will be there in PermanentEmployeeClass as it is there in base class then only it follows LSP.
    LSP : whatever methods is there in parent class that should be there in child class and child class should not change the behavior of parent class object .

  • @sauravpati8597
    @sauravpati8597 Год назад

    can you make some videos on Architecture interview questions

  • @zeez7777
    @zeez7777 7 месяцев назад

    Why not just return 0 for the bonus?

  • @sureshkumar5103
    @sureshkumar5103 6 месяцев назад

    Well explained. Thanks a lot.

  • @ravindrareddy-x7p
    @ravindrareddy-x7p 3 месяца назад

    great explanation

  • @srikanth29
    @srikanth29 Год назад

    If we return 0 in the bonus method of contractEmployees method then we wont' voilate.

  • @ravichandra786
    @ravichandra786 Год назад +1

    Good explanation😊

  • @rishavraj3127
    @rishavraj3127 7 месяцев назад

    Simply WOW 👌👌👌👌

  • @Skgupta2353
    @Skgupta2353 Год назад

    yes sure

  • @ravindran7956
    @ravindran7956 Год назад

    I feel this is not proper example for LSP

  • @compman73
    @compman73 8 месяцев назад

    Not a correct explanation of LSP
    You need to cast child to parent variable

  • @jsm33t
    @jsm33t Год назад

    Thankyou!!!!!!

  • @biswajitmishra3461
    @biswajitmishra3461 Год назад

    excellent