Dependency Injection: a discussion of the pros and cons

If you are happy with DI then go for it. I personally do not see the benefit of DI in the kind of applications which I write, and I resent the attitude of the “paradigm police” that just because THEY like DI that I should too, and if I don’t follow their “advice” (which I interpret as diktats) then I must be some sort of heretical deviant.

I don’t need DI to produce bug free software. I don’t need DI to add enhancements to my software. My point is that the effort of refactoring my entire codebase, which contains over 2,000 units of work, would be absolutely enormous. For what benefit? To make it easier to do something which I never have to do.

Even DI cannot help with badly structured or badly written code. It is not a “magic bullet” that can automatically solve all your problems. All it does is move the problem from one area to another, and in the process it introduces more complexity, more levels of indirection, more code to execute, more code to read and understand, and the potential for more bugs.

Using DI is an option, not a requirement. TDD is an option, not a requirement. I have been happily designing and developing software for several decades without using those options, and I do not believe that using those options would make either the design process or the development process any quicker or better. That is my opinion, and I’m sticking to it.