DEV Community

Discussion on: What is Dependency Injection?

Collapse
 
gypsydave5 profile image
David Wickes • Edited

The core of dependency injection, the reason we do it at all, is to make a static map of service objects.

While this is nice, it's really not the core of dependency injection. The reason why you want to do dependency injection at all is:

  • To help make code testable
  • Separate our concerns
  • Allow our code to be re-used

Take a look at

especially at the end.