Dependency Injection (DI) is a design pattern in software development that enables objects to obtain their dependencies from external sources instead of creating them internally. In simpler terms, DI is a way of achieving loose coupling in software applications.
When an object has a dependency, it requires a reference to the dependent object to function properly. Traditionally, objects would create their dependencies, making it difficult to change or update them if needed.
However, with DI, we can decouple objects from their dependencies and allow the dependencies to be injected into the object from the outside.