496
you are viewing a single comment's thread
view the rest of the comments
[-] firelizzard@programming.dev 7 points 1 year ago

I've been working primarily in Go for the past five years, including some extremely complex projects, and I have never once wished I had dependency injection. It has been wonderful. I have used dependency injection - previously I worked on a C# project for years, and that used DI - but I adore Go's simplicity and I never want to use anything else (except for JS for UI, via Electron or Wails for desktop).

[-] CodeBlooded@programming.dev 9 points 1 year ago

Go programmer here: What does Go’s simplicity have to do with dependency injection? What does a language itself have to do with dependency injection?

Reading your post and not being personally familiar with your work, I do wonder, perhaps your “extremely complex projects” wouldn’t be so extremely complex if you practiced dependency injection?

How do you unit test your extremely complex projects if your business logic carries the additional responsibility of creating objects?

[-] firelizzard@programming.dev 1 points 1 year ago

What does Go’s simplicity have to do with dependency injection?

In my experience, following Go's philosophy of simple solutions eliminates the need for complex solutions such as dependency injection.

How do you unit test your extremely complex projects if your business logic carries the additional responsibility of creating objects?

I write modular code that accepts interfaces so I can test the components I want to test. The vast majority of object creation happens at initialization time, not in the business logic. For the projects I've worked on, that would be true with or without DI - I don't see how that's relevant.

perhaps your “extremely complex projects” wouldn’t be so extremely complex if you practiced dependency injection?

When the CTO says, "Make it distributed and sharded," I do what I'm told, but that is an intrinsically complex problem. The complexity is in the overall behavior of the system. If you zoom in to the individual execution units, the business logic is relatively simple. But the behavior of the system as a whole is rather complex, and DI isn't going to change that.

[-] occams_chainsaw@programming.dev 1 points 1 year ago

I write modular code that accepts interfaces so I can test the components I want to test.

basically dependency injection

load more comments (1 replies)
load more comments (12 replies)
this post was submitted on 08 Jul 2023
496 points (97.3% liked)

Programmer Humor

19197 readers
986 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS