Skip to main content

Posts

Showing posts with the label Dependency Injection

What is the difference between IOC and DI?

Inversion of Control (IOC) and Dependency Injection (DI) are related concepts in software development, but they are not the same thing.   IOC (Inversion of control) is the design target intended to achieve between the classes and their dependencies, In other words a class should not create or control the objects it uses, but instead should rely on an external source to provide those objects. This is typically achieved by using a container or framework that creates objects and manages their lifetimes    DI (Dependency Injection) is one of the design patterns used to achieve this target There are other ways to achieve IOC which is subjected to the application  As the name suggests the flow of controls is inverted to improve the performance, maintainability and scalability.   Simply put (DI) is a specific implementation of IOC where a class's dependencies (i.e. the objects it uses) are provided to it by an external source, rather than the class creating or controlling them direc