• tatterdemalion@programming.dev
    link
    fedilink
    arrow-up
    22
    ·
    10 months ago

    Say what you want about DI frameworks, but if I have to remove another fucking global variable so I can write a test, I’m going to cut a bitch.

    • cadekat@pawb.social
      link
      fedilink
      arrow-up
      9
      arrow-down
      1
      ·
      10 months ago

      Dependency injection is so much worse. Oh, hey, where’d this value come from? Giant blob of opaque reflection code.

      • Zagorath@aussie.zone
        link
        fedilink
        English
        arrow-up
        2
        ·
        10 months ago

        It can be used in bad ways, but if it’s used in the right way you should never have the situation you just described.

        • grrgyle@slrpnk.net
          link
          fedilink
          arrow-up
          1
          ·
          10 months ago

          Same could be said of a global. There’s a time and a place for each.

          One thing I’ll say is I don’t remember us needing a team of senior+ devs to handle web app back in the day…

        • cadekat@pawb.social
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          10 months ago

          I’m not exactly sure what you mean. Doesn’t all dependency injection work the way I described?

          Without being familiar with the framework, you can’t trace your way from the class getting injected into to the configuration, even if you’re experienced with the language.