There are so many definitions of OOP out there, varying between different books, documentation and articles.

What really defines OOP?

  • Pipoca@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    11 months ago

    Javascript is generally considered OOP, but classes weren’t widely available till 2017.

    Inheritance isn’t fundamental to OOP, and neither are interfaces. You can have a duck- typed OOP language without inheritance, although I don’t know of any off the top of my head.

    Honestly, the more fundamental thing about OOP is that it’s a programming style built around objects. Sometimes OO languages are class based, or duck typing based, etc. But you’ll always have your data carrying around it’s behavior at runtime.

    • macniel@feddit.de
      link
      fedilink
      arrow-up
      1
      ·
      11 months ago

      JavaScript has been OOP since I can remember due to its prototypal nature. Change something on an inherited prototype, and every descendant also get those changes. And “classes” is just syntax sugar for that prototype mechanism.