Just finished a AngularJS course, the term dependency injection is used all over the place. Am I right the main point of it is: pass dependent objects to target's function(or constructor) rather than create them inside the target?
I get the benefit of it, easy for unit testing, etc. But I've doing it in other areas, mainly c++ with googlemock, without knowing there is a term Dependency Injection for it. So am I missing something? I guess Angular's DI has to manage lifetime of those services, factories as well as passing them into the requesting object, but that should be the implementation detail and not part of Dependency Inject concept?
Aucun commentaire:
Enregistrer un commentaire