Dependency Injection – How Does It Increase Coupling?

couplingdependency-injection

On the Wikipedia page on dependency injection, the disadvantages section tells us this:

Dependency injection increases coupling by requiring the user of a subsystem to provide for the needs of that subsystem.

with a link to an article against dependency injection.

Dependency injection makes a class use the interface instead of the concrete implementation. That should result in decreased coupling, no?

What am I missing? How is dependency injection increasing coupling between classes?

Best Answer

So, what am I missing?

Dependency Injection decreases coupling between a class and its dependency. But it increases the coupling between a class and its consumer (since the consumer needs more info to create it) and the dependency and its consumer (since the consumer needs to know the dependency to use).

Very often, this is a good trade off. The class shouldn't know the details about its dependencies beyond an interface, and it should be the responsibility of the application to tie specific bits of code together.