4 ms·
I like the part on tests. No need for dependency injection when you can just override/spyOn the functions. Most people in the .NET world uses DI, causing a lot
by jansommer 3y ago
I like the part on tests. No need for dependency injection when you can just override/spyOn the functions. Most people in the .NET world uses DI, causing a lot of smaller classes where code is dubiously grouped. And my god, all the interfaces where every use of that could just as well be the class version. But we have to use DI, because (1) people look at you like you're insane if you tell them you don't like it. And (2), we also don't want to pay for commercial software like JustMock (not affiliated) or VS Enterprise (also not affiliated), that supports mocking static methods. I think that in lack of a free, maintained and widespread library for this, C# ends up with the mess the author describes. It's a shame, because there's nothing wrong with the language itself.
Because of (1) it's a struggle to convince anyone to buy (2). And would be silly to expect someone to provide it for free.
- catlover76 3y agoI remember back when I was working at a startup that used C# and then moved to a different startup where I was responsible for choosing framework, so long as it was NodeJS. Back then, the back-end TypeScript ecosystem was very small. A couple of the frameworks used IoC and DI, which of course were a standard feature of the C# back-end I had worked on. But I never really understood what IoC and DI were for, so I didn't use one of the bigger TypeScript frameworks that used them. At the time, I thought I was dumb for not understanding the point of those things, but now, years on, I think those things really are just unnecessary. I do like C# btw and would be happy to work with it again.
- cjalmeida 3y agoDI, at least in Java is a way to avoid rolling your own custom code to add dinamicity to the language. As you point out, JS, TS and Python are dynamic enough to not need those.