Using dependency injection for encouraging loose coupling within your applications
One of the biggest problems when developing applications is inter-component dependencies. These dependencies make it hard to maintain and evolve your components individually because modifications might badly impact other dependent components. But be assured, there are mechanisms that allow those dependencies to be broken up, one of them being dependency injection (DI).
Dependency injection allows components to work together, while providing loose coupling. A component only needs to know the contract implemented by another component to work with it. With a DI container, components are not directly instantiated nor are static references used for finding an instance of another component. Instead, it is the responsibility of the DI container to retrieve the correct instance during runtime.
When a component is designed with DI in mind, it is very evolutive by default and is not dependent on any other components or...