|
|
|
|
|
by mattmanser
3057 days ago
|
|
That's utter nonsense. There's absolutely no reason you have to do DI in C#. C# only recently had native DI introduced. The only reason to use DI is to be able to inject mocks. It's the only reason. Ruby, for example, can do this without DI. It's literally making bad code just to be able to test it. It's a language bug that DI is needed. There are some who believe DI somehow magically makes your code less coupled, but go take a look at any client project in the wild and that's immediately a laughable and indefensible position. If anything, DI makes it worse. I've seen classes with 20 odd service injected, which each all have their own 10 or 15 classes injected, making that class coupled to something like 70-100 other classes. And DI makes it even harder to pick them apart. |
|
If you don't like DI and you're using C#, you're gonna be swimming upstream. It's been the C# dogma for many years. You sound like you'd be much happier away from C#.