• zerofk@lemmy.zip
    link
    fedilink
    arrow-up
    1
    ·
    7 hours 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.

    • squaresinger@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      7 hours ago

      I could maybe have been clearer when saying “significant capacity”.

      Most projects I worked in did use OOP in some capacity, but only in quite small amounts.

      My point mainly was that a lot of people think that using the keyword “class” for structs (aka data classes) or modules (aka service/controller classes) counts as OOP and that’s not the case.

      But I agree that Java and similar languages could use some other type of syntactic sugar for modules. But then again, it would literally just be another name for the same thing.