• Vector@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 months ago

    Standard shitpost and then out of nowhere “Hello inject me with beans please”

    WHY IS IT SO FUNNY

    • wer2@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      I inject myself with beans every morning, usually French press

  • Lmaydev@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    I love dependency injection personally.

    I managed to completely change how YARP routed requests by registering a single interface.

    The flexibility it provides is awesome. And it makes testing so much easier.

  • tatterdemalion@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    2 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 removed.

    • cadekat@pawb.social
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      2 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
        1
        ·
        2 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.

        • cadekat@pawb.social
          link
          fedilink
          arrow-up
          0
          ·
          2 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.

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

            I don’t think so. When I’ve seen it done it’s usually not been random values injected (except when those values are secret keys which should absolutely not be stored in code to begin with), it’s usually injecting a service. Another class, usually with a name that makes it easy to trace down. Like if you’re building an OrderService, that might take as a dependency an IProductService, which would have injected into it the class ProductService (personally, I don’t like the Hungarian notation that C# uses, but it’s a convention and my preference for sticking to strong conventions for the sake of consistency outweighs my distaste for Hungarian notation). That’s easy to find, and in fact your IDE can probably take you straight to it from the OrderService’s constructor.

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

              I’m using value in the loosest sense, like how all objects are values.

              So now if you have three implementations of IProductService, how do you know which one is configured?

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

                It’s easy to imagine a hypothetical way that could lead to problems. But in all the code I’ve worked with, either that scenario is avoided entirely, or other context makes it absolutely clear which IProductService is being used.

  • cAUzapNEAGLb@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    I fucking hate Spring.

    The quickest way to get a team of 10 contractors to turn 100 lines of basic code from a decent engineer into 2k, with 50 janky vulnerable dependencies, that needs to be babied with customized ide’s and multi-minute+ build times and 60m long recorded meetings.

    Fuck Spring.

    • MajorHavoc@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      Fuck Spring.

      Actually, there’s a lot to be said for being able to configure your spleamtomoter without needing to reverse the polarity on the stack cache rotator arm.

      I’m kidding.

      Fuck Spring.

    • passepartout@feddit.de
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 months ago

      Wouldn’t want to write a webserver / database connection / scheduler / etc. from scratch. Spring Boot plus lombok turns 2k lines of code into 100.

      • expr@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        2 months ago

        Sure… That"s what libraries are for. No one hand-rolls that stuff. You can do all of that just fine (and, actually, in a lot less code, mostly because Java is so fucking verbose) without using the nightmare that is Spring.

  • Krakaval@jlai.lu
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    Can we talk about annotations which are broken when you upgrade spring boot ? You are asked to upgrade some old application to the newest version of spring boot, application that you discover on the spot, the application does not work anymore after the upgrade, and you have to go through 10 intermediate upgrade guides to discover what could possibly be wrong ?

    • setVeryLoud(true);@lemmy.ca
      link
      fedilink
      arrow-up
      0
      ·
      2 months ago

      Holy shit mood, described to the tee.

      An application I’ve never heard or seen before that needs to be upgraded, and it breaks, so you now need to understand what the hell this application does so you can fix it properly.

      • Krakaval@jlai.lu
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 months ago

        And the management not getting why it takes so long to « just update some version numbers in Pom.xml files »…

  • deadbeef79000@lemmy.nz
    link
    fedilink
    arrow-up
    0
    arrow-down
    1
    ·
    2 months ago

    Urgh. I just sicked in my mouth.

    Die in a hole DI frameworks.

    I already have an injection ‘framework’ it’s called a constructor. I already have a factory it’s called new