Re:Clear is better than clever
by Matthias247 on Tuesday July 09, 2019 @12:31AM
(#20389040)
> "Dependency Injection" particularly drives me crazy, as we've been passing in references to objects forever
Might have been old to you, but not to everyone. I have seen plenty of codebases which inject nothing and where all objects create their dependencies themself. Lower level code is especially susceptibly to this - the amount if C code that I've seen that made use of some kind of DI tends to go towards zero. And with that often also the amount of tests that are available for the codebase (with claims like: This is not testable).
I find the term "Dependency Injection" also still unnatural and academic, but I really like the core idea, which isn't that hard to teach (pass dependencies instead of creating them yourself).
Whether one also needs DI frameworks is another topic, on which I have no strong opinion.
Re:Clear is better than clever
by gilbetron on Tuesday July 09, 2019 @08:06AM
(#20390940)
This. It makes it sound like more than it is, and while the basic idea should be taught (briefly), it isn't some amazing concept worthy of enshrining in some holy Acronym.
Might have been old to you, but not to everyone. I have seen plenty of codebases which inject nothing and where all objects create their dependencies themself. Lower level code is especially susceptibly to this - the amount if C code that I've seen that made use of some kind of DI tends to go towards zero. And with that often also the amount of tests that are available for the codebase (with claims like: This is not testable).
I find the term "Dependency Injection" also still unnatural and academic, but I really like the core idea, which isn't that hard to teach (pass dependencies instead of creating them yourself).
Whether one also needs DI frameworks is another topic, on which I have no strong opinion.