What is Liskov Substitution Principle ?

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

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

  • @happymalyo_
    @happymalyo_ 11 месяцев назад +11

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

    • @interviewhappy
      @interviewhappy  11 месяцев назад +2

      Thanks buddy and all the best for your career.

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

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

  • @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 10 месяцев назад +1

    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())*

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

    this is a better example of interface segregation than LSP

  • @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

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

    Awesome!! understood n will remain permanent in my memory

  • @shenth27
    @shenth27 3 месяца назад +1

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

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

      same question

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

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

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

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

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

    What a absolute simple explaination!

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

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

  • @muhammadadil7307
    @muhammadadil7307 9 дней назад

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

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

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

  • @Gauravkumar-jm4ve
    @Gauravkumar-jm4ve 11 месяцев назад +1

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

    • @interviewhappy
      @interviewhappy  11 месяцев назад

      Thanks Gaurav and all the best for your career.

  • @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

    • @interviewhappy
      @interviewhappy  11 месяцев назад

      It is bit similar but not the same.

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

    simple and clear explanation :)

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

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

  • @ravindrareddy-x7p
    @ravindrareddy-x7p 19 дней назад

    great explanation

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

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

  • @User-Dotnet
    @User-Dotnet 29 дней назад

    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 5 месяцев назад

    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?

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

    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 .

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

    Excellent explanation. Thank you

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

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

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

    just one word : Thanks

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

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

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

    Simply WOW 👌👌👌👌

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

    Why not just return 0 for the bonus?

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

    Well explained. Thanks a lot.

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

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

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

    Good explanation😊

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

    can you make some videos on Architecture interview questions

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

    yes sure

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

    Thankyou!!!!!!

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

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

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

    I feel this is not proper example for LSP

  • @biswajitmishra3461
    @biswajitmishra3461 10 месяцев назад

    excellent