Benefits of dependency injection

  • It improves code maintainability. Stand-alone classes are easier to fix than complicated and tightly coupled classes.
  • It improves code quality by improving code testability. If it is easy to test code, it will get tested more often which will lead to higher quality codebase.
  • Dependency injection makes code more readable as the classes used are small, to the point, compact and more clearly defined.
  • When you use dependency injection, you get loosely coupled code that is more flexible. Small classes that do one thing can more easily be reassembled and reused, which in turn saves time and money.
  • It leads to a more extendable class structure.
  • It facilitates team development as after defining abstractions, teams working together can write their code using the abstractions, even before implementations are written.

Full post here, 4 mins read