-
Notifications
You must be signed in to change notification settings - Fork 3
14. Criticism
###Criticism
"Programmers know the benefits of everything and the tradeoffs of nothing" - R.Hickey
DI is a technique that helps you create loosely coupled codebase, in which you can easily swap collaborators and make your code testable. You can use DI without any particular libraries or tools.
What's more, DI tools have some drawbacks, e.g. for unresolved dependencies feedback is given at runtime. With a new operator, you get a compile time check. But you run tests before going to production, right? Another annoyance is that you can't find usage of a class by constructor in your IDE. You have to fall back to find by class instead. Finally, a DI container is another thing you need to learn before you add it to your toolbox.
What do DI tools give you then? We've found that in some contexts using a DI tool can help. It's usually easier to handle cross cutting concerns. It removes boilerplate wiring. And when you're a framework author, a DI tool can be used to instantiate 3rd party plugins.