Dependency Injection (DI) design pattern is a common used design patterns in real-time applications as it allows us to develop loosely coupled software components.
Photo by Scott
Webb from
Pexels - modified by Beolle |
" You have probably heard about the Factory Pattern and the separation between the interface and the implementation using services, where the client objects are often responsible for service location.
The Dependency Injection pattern is a particular implementation of Inversion of Control. Inversion of Control (IoC)
means that objects do not create other objects on which they rely to do
their work. Instead, they get the objects that they need from an
outside source (for example, an xml configuration file).
Dependency Injection (DI)
means that this is done without the object intervention, usually by a
framework component that passes constructor parameters and set
properties."
Paragraph from article: ASP.NET MVC 4 Dependency Injection
Fantastic read about these patterns at MSDN location.
Recommend both links.