r/javascript • u/mmaksimovic • Apr 07 '17
Opinionated Comparison of React, Angular2, and Aurelia
https://github.com/stickfigure/blog/wiki/Opinionated-Comparison-of-React%2C-Angular2%2C-and-Aurelia
59
Upvotes
r/javascript • u/mmaksimovic • Apr 07 '17
3
u/[deleted] Apr 07 '17
You're selling DI incredibly short. Let's see how your idea of DI compares to using global variables:
An object doesn't construct its own dependencies, it "asks" for them, by name or type. Do global variables allow this? Check.
An object doesn't know how the object fulfilling its dependency is configured or implemented, it just relies on an abstraction. Do global variables allow this? Check.
I have tried to explain why DI is much more powerful than global variables, but you "disagree with my reasoning".
So, OK, I'm curious what is your reasoning then, why do you use DI instead of global variables?