Hacker News new | ask | show | jobs
by camdenreslink 1214 days ago
This has not been my experience with dependency injection frameworks in C# at all. You know what happens in a large code base when you tell all of the developers to do manual dependency injection? They don’t do it and instantiate their dependencies in the constructor because it’s easier.
3 comments

So deterministic instantiation then, which I as a (predominately C#, currently) developer actually prefer - I find it much easier to follow unfamiliar code. But whatever work for your team ...
I work in a large code base where we've told all of the developers to use dependency injection frameworks.

We are now using a mixture of 3 different dependency injection frameworks, manual dependency injection, and instantiating dependencies in the constructor.

How is that a problem with DI, instead of a problem with the engineering team not enforcing coding guidelines and libraries?
I'd prefer what you describe, because I would still be allowed to fix it (change it to manual DI).

I usually write manual DI when I want to iterate on the system and make sure each part does what it's supposed to.

Then once it works I convert it to Joe Armstrong's gorilla-holding-the-banana-and-the-whole-jungle (framework DI) so it gets past code review, and I hope to never touch it again.