r/javascript • • Dec 24 '16

The truth about Dependency injection!

https://develoger.com/the-truth-about-dependency-injection-70d715b36527#.cluegjb24
0 Upvotes

3 comments sorted by

14

u/Strobljus Dec 25 '16

Sorry to be a buzzkill, but that's hardly DI. That's a callback. Even if you would be able to technically classify it as rudimentary DI, it is so far from the architectural pattern that is most often referred to as DI that it will only confuse newbies. "Angular uses DI? No worries, I read that blog. Wait what on earth is this?!".

8

u/odisant Dec 25 '16

This is not dependency injection.

1

u/hotel2oscar Dec 25 '16

I've enjoyed proxyquire for when you want to mock out things that don't get passed in.