There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

sopuli.xyz

Krakaval , to programmer_humor in STOP DOING DEPENDENCY INJECTION

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 ?

isVeryLoud ,

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 ,

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

frazorth ,

Gradle, with it’s transitive dependency modifications is a huge pain in this area.

It used to be that if a library ended up having a flaw then it would be flagged and we would get the dependency updated. These days security block the “security risk” and you have to replace your dependencies dependency. Fingers crossed you can get it to actually test all the code paths.

If an second level project gets a flaw, and it’s used indirectly then we should really look at getting the import updated so that we know it works. If that import is abandoned then we should not be updating that second level dependency, either adopt and fix the first level dependency or look at an alternative.

agressivelyPassive ,

Spring annotations in general. There’s a completely hidden bean context where every annotation seems to throw interceptors, filters, or some reflection crap into. Every stacktrace is 200 lines of garbage, every app somehow needs 500mb for just existing and if you add something with a very narrow scope, that suddenly causes something completely unrelated to stop working.

Realistically, DI and all the Spring crap does not add anything but complexity.

Phunter ,

Our Spring service was so simple until we decided we needed annotations to handle the fetching of settings. Now we are corrupted with needless reflection.

pkill , to programmer_humor in STOP DOING DEPENDENCY INJECTION
deadbeef79000 ,

It came over the wire as text! How did you turn it into that?

Gold.

grrgyle , to programmer_humor in STOP DOING DEPENDENCY INJECTION

DI: ☺️

DI frameworks: 😒

deadbeef79000 ,

I just DI all the time, it’s called a constructor.

secret300 , to foodporn in Cast Iron Pizza

How much for you to be my chef?!

MentalEdge OP ,
@MentalEdge@sopuli.xyz avatar

I dunno man. If you can just pay me enough to cook some for myself, and have a place to live, we’d have a deal.

aluminium , (edited ) to programmer_humor in STOP DOING DEPENDENCY INJECTION

Is this even a joke? In Spring DI beans are nothing but glorified over complicated global variables.

Also this fits in here perfectly m.youtube.com/watch?v=k0qmkQGqpM8

indog ,

Spring singleton beans are supposed to be stateless though, so they can’t be called variables. Maybe the DI aspect of Spring is less relevant today in the micro service era, but in the day Spring helped make layered monolith apps much cleaner.

aluminium ,

Really? From my experience the opposite is the case. I work on a smallish team with 3 other developers and we also have a few spring services with < 100 classes and we constantly run into issues where making changes to a bean causes issues in another unrelated part of the codebase. I can’t imagine what a nightmare it would be with a larger codebase and more devs working on it.

cAUzapNEAGLb , to programmer_humor in STOP DOING DEPENDENCY INJECTION

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.

passepartout ,

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

MajorHavoc ,

… Looks both ways…

Python does the same in 10 lines of code.

… Ducks under a table to avoid the ensuring flames …

SpaceNoodle ,

I replaced the P in my LAMP stand with Python and I’ve never been happier.

MajorHavoc ,

Same here.

VantaBrandon ,

They say he’s still ducking to this day

MajorHavoc ,

Yep. That’s why we call it “duck typing” in Python.

expr ,

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.

SpaceNoodle ,

They can do that in any season

dohpaz42 ,
@dohpaz42@lemmy.world avatar

Ok, you win! 😁 😂

MajorHavoc ,

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.

valid , to funny in dog dog dog
FreshLight , to funny in dog dog dog

You could also go for “Dreihund” or “Fluffy

Lmaydev , to programmer_humor in STOP DOING DEPENDENCY INJECTION

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.

YtA4QCam2A9j7EfTgHrH , to science_memes in Seal ions

If you want to read about ocean mammals on strike, you should do yourself a favor and read John Scalzi’s “Starter Villain.” It is a hoot.

DragonTypeWyvern ,

I hope the dolphins find out out about syndicalism one day

jimmydoreisalefty , to science_memes in Seal ions
@jimmydoreisalefty@lemmy.world avatar

Noice one!

Cat(ion)s and an(i)ons must unite and join the general strike with the seals!

Naming:

Sealium ion, positive charge

Sealide ion, negative charge

koncertejo , to programmer_humor in STOP DOING DEPENDENCY INJECTION

As an audio engineer, I was very confused about what this had to do with Direct Injection for a second.

Pyro , to programmer_humor in STOP DOING DEPENDENCY INJECTION

Hello inject me with beans please

not again

Klear ,

Yeah, I’d rather get injeancted with beans.

Mikina , to programmer_humor in STOP DOING DEPENDENCY INJECTION

My favourite take on DI is this set of articles from like 12 years ago, written by a guy who has written the first DI framework for Unity, on which are the currently popular ones, such as Zenject, based on.

The first two articles are pretty basic, explaining his reasoning and why it’s such a cool concept and way forward.

Then, there’s this update:

https://programming.dev/pictrs/image/4029a87e-866e-48b2-9be6-3d1091bbf2fc.png

Followed by more articles about why he thinks it was a mistake, and he no longer recommends or uses DI in Unity in favor of manual dependency injection. And I kind of agree - his main reasoning is that it’s really easy for unnecessary dependencies to sneak up into your code-base, since it’s really easy to just write another [Inject] without a second thought and be done with it.

However, with manual dependency injection through constructor parameters, you will take a step back when you’re adding 11th parameter to the constructor, and will take a moment to think whether there’s really no other better way. Of course, this should not be an relevant issue with experienced programmers, but it’s not as inherently obvious you’re doing something potentially wrong, when you just add another [Inject], when compared to adding another constructor parameter.

docAvid ,

Exactly. Dependency injection is good; if you need a framework to do it, you’re probably doing it wrong; if your framework is too magical, you’re probably not even doing it at all anymore.

Solemarc , to programmer_humor in STOP DOING DEPENDENCY INJECTION

At work we have a lot of old monolithic OOP PHP code. Dependency injection has been the new way to do things since before I started and it’s basically never used anywhere.

I assume most people just find it easier to create a new class instance where it’s needed.

I’ve never really seen a case where I think, “dependency injection would be amazing here” I assume there is a case otherwise it wouldn’t exist.

lorty ,
@lorty@lemmygrad.ml avatar

Isn’t the point of injecting classes so that you don’t have tens of instances of the same class in memory?

epyon22 ,

When we implemented it significantly improved our ability to write unit tests. It also allowed us to make more modular code due to the default of every class having an interface. So I’m all for it.

MajorHavoc ,

Yeah. Injection has a place in test patterns. Thankfully, it’s usually possible to hide injection from strongly affecting anything else that matters, as long as the team hates injection deeply enough.

porgamrer ,

In my opinion dependency injection solves a problem that doesn’t need to exist, and does it by adding even more obfuscation and complexity.

The problem is that the original gang of four design patterns had very little to say about managing effects. In old java code things like network and file IO often happen deep inside the object graph, hidden behind multiple impenetrable abstractions such that it’s impossible to run the logic without triggering the effect.

The wrong solution is to add even more obfuscation and abstraction, so that you can inject replacement classes deep inside the object graph where the effects happen. it solves the immediate problem of implementing tests, but makes everything else worse and more confusing.

The right solution is to surface all your effects at the top level of the call graph. The logic only generates data, and passes it back up to the top level of the program. The top level code then decides whether to feed this data into an effectful operation. Now all your code is easier to reason about, and in you can easily test the logic without triggering unwanted effects.

MajorHavoc ,

Could be. There’s easier ways to minimize instances in memory. That’s what GLOBAL variables are for.

P.S. I have now gone: 0 days without trying to wind up other senior developers.

xmunk ,

As a fellow PHP dev (working in laminas specifically) DI actually is fucking awful, there’s a distinction between a service factory pattern and this thing called DI which is similar to a service factory pattern but uses reflection based type sniffing to guess at which service you want where. I’d considered making a reference to it but PHP developers are few and far between these days.

VantaBrandon ,

There are dozens of us

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • lifeLocal
  • goranko
  • All magazines