this post was submitted on 03 Nov 2025
112 points (96.7% liked)
Programming
23348 readers
261 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Like anything else, it can be useful in the right context if not followed too dogmatically, and instead is used when there is a tangible benefit.
For example, I nearly always dependency inject dependencies with I/O because I can then inject test doubles with no I/O for fast and stable integration tests. Sometimes, this also improves re-usability, and for example, a client for one vendor’s API can be substituted with another, but this benefit doesn’t materialize that often. I rarely dependency inject dependencies with no side-effects because it’s rare that any tangible benefit materializes, and everyone deals with the additional complexity for years with no reason. With just I/O dependencies, I’ve generally found no need for a DI container in most codebases, but codebases that dependency inject everything make a DI container basically mandatory, and its usually extra overhead for nothing, IMO. There may be codebases where dependency injecting everything makes perfect sense, but I haven’t found one yet.