Dependency Injection Debate

This cluster centers on debates about the value, implementation, and necessity of dependency injection (DI) in programming, including comparisons to constructors, manual DI, modules, and frameworks across various languages.

📉 Falling 0.5x Programming Languages
2,938
Comments
19
Years Active
5
Top Authors
#6245
Topic ID

Activity Over Time

2008
5
2009
20
2010
25
2011
59
2012
63
2013
223
2014
218
2015
171
2016
124
2017
185
2018
152
2019
150
2020
228
2021
244
2022
318
2023
283
2024
174
2025
289
2026
7

Keywords

tyrrrz.me OO PHP JS HN XML ES6 NOT MSOA SICP dependency injection injection di dependency constructor dependencies bt injected constants modules

Sample Comments

Scarbutt Oct 3, 2022 View on HN

Disagree on using a lib? cause I guess doing manual DI is still DI.

fizwhiz Sep 20, 2015 View on HN

Your comment is unclear. Are you encouraging people to NOT use DI frameworks, or using them only with constructor-based injection?

aristidb Apr 18, 2018 View on HN

I've never quite understood the appeal of Dependency Injection. What's wrong with just using constructors?

nulltype Apr 12, 2015 View on HN

Could you provide a concrete example of a good use of DI?

Kiro Apr 21, 2018 View on HN

How do module systems make IOC and DI obsolete? What's the argument?

UK-Al05 Oct 31, 2019 View on HN

Most DI frameworks you explicitly pass things in via the constructor. I don't get it.

riwsky Apr 21, 2024 View on HN

Witness the power of dependency injection

donpark Feb 10, 2011 View on HN

Dependency injection separates discovery from dependency. It's neither good nor bad but can be useful as well as abused beyond ad nauseum. End of story.

jasondenizac Nov 3, 2012 View on HN

Dependency Injection is a way to achieve Inversion of Control - meaning the consuming modules aren't concerned with the implementation or instantiation of their dependencies. Dynamic languages have less of a need for Dependency Injection than statically typed languages, but things like instance lifecycle management and policy injection are still very much relevant for good modular design.

layer8 Apr 20, 2025 View on HN

I don't understand what you're describing has to do with dependency injection. See https://news.ycombinator.com/item?id=43740196.