Inversion of Control (IoC) design is achieved using service locator, factory pattern or Dependency Injection (DI). DI is the recent framework to build in the modern application framework.
As depicted in the diagram, DI has 4 core elements
- Client - dependent role
- Server - functionality provider
- Injector - creates server instances to client
- Interface - communication contract between client and server
DI decouples objects from their dependencies by receiving from an external source - not with direct implementations.
Multiple ways of dependency injection implementations are available in github https://github.com/gsenthilvel/InversionOfControl
Top-3 advantages
- Loosely coupled
- Unit testability
- Scalability
Top-3 disadvantages
- Complexity to develop
- Reduced transparency
- Overhead to troubleshoot/debug
No comments:
Post a Comment