DEV Community

Discussion on: What is Dependency Injection?

Collapse
 
joshcheek profile image
Josh Cheek

Dependency injection is basically passing parameters to a function. It really is that simple. The reason that we like to do this is so we can keep a separation of responsibilities in the code. Are you surprised? It's not a framework and it doesn't have to be anything fancy. You can do dependency injection using constructors or a setter method.

πŸ‘†truth