3 ms·
This comment packs a lot of confusion into very few words. You're conflating a factory abstraction like Spring with dependency injection. void foo(Reader r) {
by h_r 14y ago
This comment packs a lot of confusion into very few words. You're conflating a factory abstraction like Spring with dependency injection.
void foo(Reader r) { /do stuff with r/ }
...
foo(new BufferedReader(new FileReader("/log.txt")));
There, I just did dependency injection without a trace of reflection. Additionally, since everything is statically typed in Java, refactoring is still vastly simpler than with a dynamically typed language. The few spots in the code where you might be trying an invalid type cast are just that - a few spots. Such problems don't permeate the entire codebase as they do with a dynamic language. And I'm saying this as a huge fan of Clojure and Groovy, preferring them over Java on the JVM.
[edit: changed "strongly" to "statically"]