I don't know what environments, platforms and coding styles you guys are
using, so it's hard for me to picture how you benefit from DI. I'm mostly
writing WPF, Xamarin Forms, Blazor Wasm and WebAPI at the moment (luckily
no MVC!), and I don't have any problems that DI can solve. I don't have
deep class composition problems or "volatile" dependencies or similar where
DI would help me.

If I start using some DI container, then I'll have to pick one out of the
zoo, learn it, make interfaces and classes, add references, expand
constructors, configure it, etc. I've previously found that debugging
step-into can get lost in the DI code and the IDE has more trouble finding
refences and definitions. Injection code can proliferate and duplicate, I'm
not sure of the lifetime of the dependencies, but worst of all it's all
just more clutter and something I detest … "magic plumbing".

I know some people frown upon this, but I'm quite happy to have a simple
static class in the AppDomain that provides services like logging, http
client, etc which live for the app lifetime anyway. For unit testing I can
just flip a few lines of code.

*GK*

>

Reply via email to