Skip to main content

One post tagged with "patterns"

View All Tags

Downsides of Dependency Injection

· 4 min read

What problems does DI solve? I really like what wikipedia says

The intent behind dependency injection is to achieve separation of concerns of construction and use of objects.

If class A needs to use class B, it does not need to create an instance of it. This will give A too much responsibility since beside its actual requirements it has to manage the lifetime of the instance of B.