Ask HN: When "not" to use Dependency Injection?
I have seen numerous articles endorsing dependency injection (DI) in software development. Frameworks such as Spring and Guice provide excellent support for dependency injection, and I am a fan of designing and writing code that minimizes any coupling and provides more flexibility.
What are some of the practices when we "do not" use dependency injection (DI)? What arguments exists for not using DI for these scenarios?
2 comments
[ 3.1 ms ] story [ 27.7 ms ] threadhttp://tutorials.jenkov.com/dependency-injection/when-to-use...
You can always get away with using "sinful hacks" (in the eyes of some DI evangelists) like wrapping dependencies in a getter/setter if you just want to inject a mock version for testing.