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.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

davidgro , in STOP DOING DEPENDENCY INJECTION

I think this might be the first of these I’ve seen where pretty much all the comments are just agreement.

MajorHavoc , in STOP DOING DEPENDENCY INJECTION

I’ll never plaster the back of my car with stickers that all proclaim the same things in ALL CAPS.

But if I was going to…

It would pretty much match this meme.

Vector , in STOP DOING DEPENDENCY INJECTION

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

WHY IS IT SO FUNNY

wer2 ,

I inject myself with beans every morning, usually French press

SpaceNoodle , in STOP DOING DEPENDENCY INJECTION

Tell me more about these beans

Solemarc , 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

steventhedev , in STOP DOING DEPENDENCY INJECTION

XML is the second worst programming language ever created by humans

nxdefiant ,

I’m gonna need a bell curve hooded figure meme template of this comment, this is comedy gold.

marcos ,

Good luck deciding where each opinion goes.

SpaceNoodle ,

It’s a markup language, not a programming language.

towerful ,

Like yaml/toml

marcos ,

The one benefit of toml is that nobody creates a programing language over it.

nxdefiant ,

so far

MajorHavoc ,

The one benefit of toml is that nobody creates a programing language over it.

Heh. Any day though, right? I can’t wait to see an excited presentation on code-free coding in YAML…

frezik ,

Github Actions have entered the chat.

MajorHavoc ,

Thanks. I hate that you’re right.

steventhedev ,

Whoosh

Seriously though, spring configurations are written in XML and you create variables, call functions, and have control flow. Effectively turning XML into a horrible twisted shadow of a programming language.

All in the name of “configurability” through dependency injection.

lars ,
@lars@programming.dev avatar

Spring moved away from XML ages ago. I work on a 6 year old Spring project and it has never had a single line of XML in it.

MajorHavoc ,

I’m fond of saying that all great code earns it’s right to become good code by starting as trash…

But I still think we should all quietly and politely let Spring die a simple dignified death, as soon as possible.

Out of wildly morbid curiosity, do Maven and Ant still shit all over each other to make sure no one has any real idea what the build inputs and outputs are?

I shouldn’t ask things I don’t really want to know, though. My inbox is gonna be full of Java apologists.

lars ,
@lars@programming.dev avatar

No idea, I’ve never used either of those tools.

I think some people use Maven, I use Gradle in all of mine. Gradle build files are written in Kotlin instead of XML like Maven.

MajorHavoc ,

No idea, I’ve never used either of those tools.

That’s a relief to hear. They were quite bad. Or rather, the way most teams used them was quite bad.

I’ve heard nice things about Gradle. Of course that was mainly from people with deep psychological scars after working with Ant and Maven…

JustBrian7872 ,

Thanks, my companies’ codebase feels old now.

AMDIsOurLord ,

So if you take XML, pervert it beyond recognition, cut off it’s balls and one hand, then it’s somehow it’s fault that it sucks?

steventhedev ,

They started from XML. There’s nowhere to go but up but spring managed to fuck even that up.

FactoryStrategyFactoryFactoryObserverInterface

Friends don’t let friends use Java 😜

dohpaz42 ,
@dohpaz42@lemmy.world avatar

Tell that to SOAP.

deadbeef79000 ,

Yo dawg, I heard you like XML over HTTP so I put XML over HTTP in your XML over HTTP.

frezik ,

It was a markup language until someone decided to parse and execute it as a programming language. This person should be watched for other deranged behavior.

ZILtoid1991 ,

I use XML as markup language, what kind of deranged person thought to turn it into a programming language? My problems with the Lua API led me down the rabbit hole of making my own VM and implementation, not looking at a markup languge, then go “what if I used this for scripting?”.

frezik ,

When they make XML do these things (or the way Github Actions does it with YAML), they’re essentially creating a representation of the AST that the compiler would make internally from a mini language. So there’s a few possibilities:

  • They don’t know how compilers work and reach for a tool they do know
  • They know, but figure the problem at hand doesn’t need the complexity of a mini language and start the project the quick and dirty way, and it gets out of hand as they add features
  • They may or may not know, but they do get caught up in the hype of some other tool (likely what happened with XSLT)
cAUzapNEAGLb , 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.

xmunk , in STOP DOING DEPENDENCY INJECTION

We’re struggling to deal with climate change and these selfish developers can think of nothing except building more factories. This is a global issue, we need a global solution: eschew factories and services for defining everything globally.

Pyro , in STOP DOING DEPENDENCY INJECTION

Hello inject me with beans please

not again

Klear ,

Yeah, I’d rather get injeancted with beans.

redcalcium , in New developer

When I was a teenager, I made a page in Word, saved it as html, then uploaded it to geocities. Good times.

BiteCode ,

That was not far away from what frontpage was honestly.

fadedmaster ,
@fadedmaster@sh.itjust.works avatar

Oh jeez. I completely forgot about Frontpage. That just brought some memories back.

ctenidium ,

Very clever! You need to find the tools you can work with to accomplish your goal.

RiikkaTheIcePrincess ,
@RiikkaTheIcePrincess@pawb.social avatar

<.< When I was a teenager (maybe early teens? Idunno, I’m not super old 😅 🧓 ) that’s just how we made websites 😹

narc0tic_bird ,

That’s what started it all for me tbh :D

KindaABigDyl , in New developer
@KindaABigDyl@programming.dev avatar

LibreOffice is the superior IDE for Delphi

onlinepersona ,

And for VB

(Does LibreOffice finally support another scripting language?)

Anti Commercial-AI license

marcos ,

Doesn’t all of it support Python?

Scoopta ,
@Scoopta@programming.dev avatar

Always has? It’s supported java and I think python for forever

PoastRotato , in New developer
@PoastRotato@lemmy.world avatar

I just threw up in my mouth a little.

voracitude ,
RiikkaTheIcePrincess ,
@RiikkaTheIcePrincess@pawb.social avatar

I kinda wanna upvote this but it’s horrible so I’m posting this instead 😅

voracitude ,

I apologise, and I also apologise that I’m not apologising that hard about it 😂

qaz ,

Why?

ZILtoid1991 , in Who is this JSON guy?

I want to create a JSON parser called JSON-X.

andioop , in Who is this JSON guy?

oh god I always read JSON like “J” + “son”, “son” being like a Spanish word for “to be”. Or “J” + “sewn”. I can’t believe I’ve never read it like the human name “Jason”.

devfuuu , in The IT experience?

Manga: “Because I, the True Saint, Was Banished, That Country Is Done For!”

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines