4 ms·
My own opinions on the matter aside, I don't fully understand why anyone who likes dynamic scoping would dislike dependency injection.
by Jweb_Guru 10y ago
My own opinions on the matter aside, I don't fully understand why anyone who likes dynamic scoping would dislike dependency injection.
- sedachv 10y agoBecause of things like: https://github.com/google/guice https://github.com/google/guice 4k LOC of "lightweight" garbage for... variable lookups?
- nickpsecurity 10y agoTo put that into perspective, the Squeak interpreter for the gold standard of OOP languages, Smalltalk, was about 3951loc of Smalltalk for logic to handle language and 1681loc of C for OS interface. A lightweight scheme for dependency injection took them more loc to express than a whole Smalltalk interpreter. And to hack around bad OOP or tooling in the first place. This might not mean anything. It just jumped out in my brain for some reason.
- Jweb_Guru 10y agoSo your issue is with the implementation? I can understand that, I guess. Personally I don't like either dynamic scoping or DI; it had just never occurred to me that someone might prefer one to the other.