- Separate the process of creation and consumption of dependencies
- Let the consumer worry only about how to use the dependency, and leave the process of creation of the dependency to somebody else
- Allow concurrent/independent development of the dependency and the dependent entity, while only maintaing a known contract
- Facilitate changing of the dependencies when needed
- Allow injecting mock objects as dependencies for testing, by maintaining the agreed contract
Saturday, September 19, 2015
Benefits of Dependency Injection
This question is often asked at interviews, and a good list of reasons to use it can be found at http://anandmanisankar.com/posts/angularjs-dependency-injection-demystified/:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment