Liskov: The Liskov Substitution Principle

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 เม.ย. 2020
  • Barbara Liskov, winner of the Association for Computing Machinery's A.M. Turing Award, discusses the origins, and naming, of the Liskov Substitution Principle which defines the relationship between subtypes and supertypes in object-oriented programming. This clip taken from an interview conducted with Liskov by Tom van Vleck for the ACM on April 20, 2016. Video of the full interview is available as part of Liskov’s ACM profile at amturing.acm.org/interviews/l....

ความคิดเห็น • 38

  • @amirkhazama7464
    @amirkhazama7464 ปีที่แล้ว +24

    2:36 is just pure perfection god I hate confusing internet articles

    • @mydadletsmeshootatcats6754
      @mydadletsmeshootatcats6754 7 หลายเดือนก่อน +2

      Tell me about it. Been trying to grok this from other videos and articles. It finally clicked when I heard this explanation.

  • @user-fg6ng7ej6w
    @user-fg6ng7ej6w 9 หลายเดือนก่อน +9

    cool to hear real meaning of the principle from first hands. thanks

  • @kapsi
    @kapsi ปีที่แล้ว +15

    One of the heroes that created computing and changed the world forever.

    • @VastyVastyVoid
      @VastyVastyVoid หลายเดือนก่อน

      Yeah. What's great is that she's really pragmatic about it, too. She uses plain words to describe it because to her, this isn't some ivory tower principle, it's something she actually understands on a fundamental level.
      I feel we're teaching this badly.

  • @GodofStories
    @GodofStories 7 หลายเดือนก่อน +4

    Great to see a legitimate women pioneer. Who many girls could see for inspiration as sadly many don't have role models to look up to in comp sci/tech.

  • @NatarajSubramanian
    @NatarajSubramanian 3 ปีที่แล้ว +10

    Wow! Thanks for uploading this! 🙏

  • @itorrestp
    @itorrestp ปีที่แล้ว +1

    Without this woman, probably i would not able to write this comment.

  • @ahmadganteng7435
    @ahmadganteng7435 6 หลายเดือนก่อน

    Beautiful idea, Maam..
    This principle is very important to understand

  • @aaronza7218
    @aaronza7218 3 หลายเดือนก่อน

    Finally! I understand. Thank you for sharing this video!

  • @dionkim
    @dionkim 3 ปีที่แล้ว +3

    Thank you!

  • @IndependentSpirit1923
    @IndependentSpirit1923 2 ปีที่แล้ว +4

    Big respect to this intelligent lady.

  • @muskduh
    @muskduh 2 ปีที่แล้ว +2

    thanks

  • @NubeBuster
    @NubeBuster 10 หลายเดือนก่อน +3

    Could someone explain how code could even exist without this principle. Moreover, I dont understand how it would be possible to have either a stack or queue as a method parameter without knowing which it is.
    Most of my experience is in Java. Perhaps javas rules prevent you from doing this?
    Edit: chatgpt gave an answer which I couldn't have thought of.
    Say you have a super type Bird. Then a subclass Ostrich. Bird has a method called fly(). In Ostrich yoy would throw an exception because ostriches cant fly.
    That is horrible code and i completely see the value of this principle

    • @samuelskean6312
      @samuelskean6312 4 หลายเดือนก่อน +1

      Code can certainly exist without this principle. Languages like C do not really provide ways to even describe subtype or super type relationships. It's pretty hard to write code in C where one type is conceptually a subtype of another. I'm honestly not sure how people approach problems that seem best expressed with sub typing relationships in C, but I know it's possible. For instance, if I had a function that needed to take some "collection" (dictionary, vector, or any other kind of collection) and act on every element of it, I could easily express that in Java as a method that takes a parameter of type "Collection". In C, I would (probably naively) create different versions of that function for every concrete type (every implementation of a collection) that I actually wanted to use it with. I'm sure there are better ways, even in C.
      The Bird/Ostrich example is neat, thanks for sharing that! At least for that case, Java has at least one feature that can help prevent that mistake: checked exceptions. If the exception in that example does not descend from the class RuntimeException, then you would have to declare the method fly as potentially "throwing" that exception or some super type of it. Because that declaration is part of the method's signature, you would have to declare that property in the signature of the fly method both on the class Ostrich and on the class Bird. So, you'd have something that looks like this in your Bird class:
      void fly(/* some parameters */) throws CannotFly {
      That means you've declared a fly method on Birds that you can clearly see sometimes fails to work.
      I don't think this is always a horrible idea as to how to define things, but it's certainly unintuitive. It doesn't technically violate the Liskov substitution principle here because we've said sometimes a Bird's fly method returns CannotFly - so the definition for Ostrich follows that rule. (I'm following the definition of the Liskov substitution principle here: en.wikipedia.org/wiki/Liskov_substitution_principle).
      However, if CannotFly were a subclass of RuntimeException, then this declaration would not be required, and you could more easily violate the Liskov substitution principle without knowing it.
      I hope this helps!

  • @shanep7131
    @shanep7131 3 ปีที่แล้ว +3

    AMAZING

  • @Trick1e
    @Trick1e 2 ปีที่แล้ว +1

    i don't know why but this is so wholesome

  • @thevitto23
    @thevitto23 ปีที่แล้ว +4

    Is she Barbara Liskow?

  • @JockerTheRipper
    @JockerTheRipper 2 ปีที่แล้ว +2

    A very simple explanation she said - Behavioural subtyping - subtypes behave like super types 👍👍

    • @jja77a
      @jja77a 2 ปีที่แล้ว +1

      that's not what she said at all!

    • @JockerTheRipper
      @JockerTheRipper 2 ปีที่แล้ว

      @@jja77a : watch the video once again from 4:05.
      You can apologise later 😂

    • @Tumbledweeb
      @Tumbledweeb ปีที่แล้ว

      Is that super?
      Sorry, I know absolutely fuck all about programming languages. I don't even know how I ended up here... I must be a Subtype, following the lead of the Supertypes, yeah? :D
      No? Hm...
      Oh! One thing I'm REAL good at is getting software to glitch out, so... Anyone need a tester to thoroughly break what you've built? :D

  • @lorenzrosenthal119
    @lorenzrosenthal119 2 ปีที่แล้ว +13

    "Behavioral Subtyping" (subtypes behave like supertypes) is much more intuitive than "Liskov Substitution Principle"!!

    • @gloverelaxis
      @gloverelaxis ปีที่แล้ว +7

      i have huge respect for Barbara Liskov and her intellectual clarity, and her contributions to computer science should definitely be remembered, but it's also very important that we keep *everything* in CS as intuitive and simple as we can manage to, and that absolutely must include the names we use for things! "behavioral subtyping" is indeed a better name. it's ironic that it's the name she gave it, too, haha!

    • @arpanmukherjee4625
      @arpanmukherjee4625 6 หลายเดือนก่อน +1

      I am gonna call it SOBID priciples now. 99% engineers can intuitively remember the usages and meanings of S O I D but not the L, because S O I D are intuitive names.

    • @aaronza7218
      @aaronza7218 3 หลายเดือนก่อน

      100% agree!

    • @talideon
      @talideon หลายเดือนก่อน

      ​@@gloverelaxis I'm pretty sure she didn't name it after herself.

  • @beegdigit9811
    @beegdigit9811 6 หลายเดือนก่อน +1

    This is THE explanation from the CREATOR, so sad other videos on this subject have more views

  • @nickbarton3191
    @nickbarton3191 21 วันที่ผ่านมา

    How much confusion there is out there about this principle.

  • @gloverelaxis
    @gloverelaxis ปีที่แล้ว +17

    can't understate how happy I was when looking up Liskov Substitution to discover this critical idea was conceived by a woman in this catastrophically male-dominated field. we owe so much to the intelligence of women like Liskov, Hopper and Margaret Hamilton, and we should do everything we can to destroy every last vestige of bigotry in this industry, so everyone feels welcome to explore and improve computing

    • @walid-sb6vc
      @walid-sb6vc ปีที่แล้ว

      what? what bigotry? gender has nothing to do with it lol it's not like there's a system preventing them since waaay back 1930s there was Mary cury etc female scientists well recognised. STOP PRETENDING LIKE WE'RE SOME TYPE OF PATRIEARCHY it is what it is when women are smart and invent something it's immediately recognised period we shouldn't even have a debat about genders totally meaningless SCIENCE IS THE ABSOLUT nothing else don't involve it in political squabls

    • @martinkrauser4029
      @martinkrauser4029 24 วันที่ผ่านมา +2

      Women started the field of software development from the ground up. It didn't become male-dominated until the mid-80 with the advent of personal computers, computers that were marketed to men and boys and that parents never bought for girls. Using one became prerequisite knowledge for college.

    • @Valdivia9494
      @Valdivia9494 11 วันที่ผ่านมา

      OMG don't swallow the propaganda, it's nobody's fault that it's "male dominated", many women are awesome at Software Development, they simply don't like it as much as other things. It may be truth that there was marketing made towards men in the 80s, that's almost 40 years ago and the trend continues in this digital era where many has access to technology. Also you see the same trend in many countries where this sort of publicity wasn't predominant or didn't exist at all.

  • @orek7327
    @orek7327 ปีที่แล้ว +3

    So ummm. Liskov is woman ?. I tought she is man

    • @martinkrauser4029
      @martinkrauser4029 24 วันที่ผ่านมา

      thinking about why you thought that is something for you to think about, innit

    • @soonhongng7037
      @soonhongng7037 20 วันที่ผ่านมา

      cheers matr