Hacker News new | ask | show | jobs
by arcosdev 1699 days ago
This article was so helpful in communicating my exact frustration with DI in .NET. "Why does this have to be so complicated? This is so simple in JavaScript." just kept running through my head the entire time.
2 comments

Why can't you just do DI the same way you do it in JS? You can pass Objects as parameters to functions and that's all you need.
You are right, but I was learning they way "it is done" at the time.
AspNet style dependency injection has dug it's claws in to an insane degree, and it's almost always completely unnecessary. If you're never going to change the implementation of a logger or a database connection, there is almost zero value in standing up the whole DI machinery rather than a simple singleton.