News for hackers. Stuff that matters.
Re:Dependency injection in Go with Uber-go/fx by e4e78a06 on Sunday February 27, 2022 @03:02PM (#30491944)
You say this now, but I've had to work on 5000 line (literally, 5k lines) classes in legacy code where there are a huge number of dependencies injected manually because the class is doing initialization for a huge number of components. You could argue that this was bad design but I'm sure it didn't start out like that, but just accumulated cruft over time and was too dangerous to refactor. (if prod went down it was at least a few hundred $k down the drain). DI makes it much simpler to wire things like this up without making mistakes like accidentally initializing the wrong class implementation, etc. In polymorphism heavy situations it reduces cognitive complexity a lot.
Re:Dependency injection in Go with Uber-go/fx by csande17 on Sunday February 27, 2022 @03:26PM (#30492149)
Dependency Injection frameworks definitely seem like one of those technologies that primarily exists to allow people to get away with bad designs, rather than making it easier to create good designs.
Re:Dependency injection in Go with Uber-go/fx by Rexxar on Monday February 28, 2022 @04:42AM (#30498103)
5000 lines doesn't tell anything important. I preferred a well organize 5000 lines than 250 files of 20 lines spread randomly in various directories.

If it's 5000 lines and messy it is indeed a problem, but only because it's messy.