• Moah
    link
    fedilink
    English
    arrow-up
    14
    ·
    7 hours ago

    There’s literally nothing related to OOP in this snippet.

    • davidagain@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      16 minutes ago

      You’re right, this is just not oop AT ALL.

      For the correct OOP solution, you would need consider whether this can be thought of as a kind of stateless leaf method, and therefore implement it as an abstract (singleton) factory, but on the other hand, if you’re using a context object with the registry pattern, you should probably do this properly with IoC containers. Of course, if your object graph isn’t too complex or entangled, you could always just do constructor injection but you risk manging your unit tests, so I would go cautiously if I were looking in that direction.

        • davidagain@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          18 minutes ago

          What about a factory for the factories! There’s nothing more efficient than a tool making tool making tool.

      • collapse_already@lemmy.ml
        link
        fedilink
        English
        arrow-up
        3
        ·
        3 hours ago

        Shouldn’t there be a call to the boolean comparison microservices server in there somewhere? Also, we should consider the possibility that booleans and their operators could be overloaded to do something else entirely. We might need a server farm to handle all of the boolean comparison service requests.

        • davidagain@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          21 minutes ago

          You’re so right, I didn’t think of that. Maybe I’m not cut out to be a manager in IT.