• squaresinger@lemmy.world
    link
    fedilink
    arrow-up
    2
    arrow-down
    3
    ·
    9 days ago

    Have you ever seen a real-world project that actually uses OOP in any significant capacity? I haven’t.

    When using Java, you might write “class” on top of your structs and modules, but actual OOP with self-contained classes that contain both data and business logic using inheritance and all the other OOP concepts, that’s incredibly rare.

    • zerofk@lemmy.zip
      link
      fedilink
      arrow-up
      1
      ·
      8 days ago

      I have seen and worked on many projects that use inheritance, polymorphism, interfaces, all the staples of OOP. It’s true that none of these use only OOP principles and applies them rigorously. Real world projects are almost? always a mix of many different paradigms, because the truth is no one paradigm matches all use cases - and every programmer is only familiar with a few anyway.

      This is one of the ways I believe Java went wrong: the program entry point is naturally a function, not an object. Wrapping main in an object makes little sense. Similarly, having absolutely everything inherit “Object” is forcing OOP where it doesn’t belong.

      But that doesn’t mean OOP isn’t used in the real world. It is.