News for hackers. Stuff that matters.
Re:Astonishing Performance of .NET 5 by christophilus on Thursday November 12, 2020 @11:36AM (#25071580)
I spent maybe 15 years using C# and DI (for most of that time), and understand it pretty well. I still dislike it.

> just they'll be hidden and tightly coupled

They're more hidden with DI than without, in my experience.

At any rate, having left the .NET stack around 5 years ago, I certainly don't miss DI. My current code has more and better tests than my C# code ever did, so DI didn't really help me there (nor did it hinder me-- it was neutral). But my current code is much more explicit, direct, and a fair bit more compact. I'm definitely happier with it.

Re:Astonishing Performance of .NET 5 by ivanche on Thursday November 12, 2020 @05:57PM (#25076385)
Compare 2 classes. Class A expects all its dependencies to be passed as constructor parameters. Class B has a default no-arg constructor, but buried inside 5 of its methods calls Dep1 dep1 = new Dep1(); or Dep2 dep2 = new Dep2(); Now, which class has obvious and loosely coupled dependencies? Which class has hidden and tightly coupled dependencies?

To me, answer is clear - class A has obvious and loosely coupled ones. Lo and behold, class A comes from program which uses DI. Class B doesn't.

Re:Astonishing Performance of .NET 5 by apta on Friday November 13, 2020 @04:25AM (#25080607)
Which stack did you move to?