Simple Definitions
Dependency Injection ( DI )
A programming technique where
dependencies of class or function passed in from the outside, rather than being created or instantiated inside the class or function
.
Keyword : External dependencies
, Inject
, Pass in
Related Contents
Inversion of Control ( IoC )
A design pattern where control over the flow of a program is inverted or moved to a separate component or framework.
Instead of the application code controlling the flow of control
, a separate component or framework takes over that responsibility.
Keyword : Separate component
, Framework
, Flow of control
Related Contents
Main difference between DI
and IoC
While DI is often used in conjunction with IoC frameworks or containers, it is not the same as IoC itself. DI is a specific technique for managing dependencies, while IoC is a broader principle for managing control flow in a software system.