
Dependency injection in .NET
by Mark Seemann · first published 2012
11mentions
7recommended by
9HN commenters
2013–2021first – last mentioned
78% recommend11% neutral11% critical
Why HN recommends it
The best resource for understanding what dependency injection is and why it helps, taking a bottom-up, language-agnostic approach to inversion of control. Useful for non-.NET developers with basic OOP knowledge.
Summarised by Claude from recommending comments
Affiliate links. As an Amazon Associate I earn from qualifying purchases.






advantage is when you manage to couple things at composition root (which is the very beginning of your application). that way there is one convenient place where coupling takes place. read "Dependency injection in .Net" by Mark Seemann. it's the best resource to understand wtf DI is all about and what are benefits.
on “Dependency Injection for Python” ↗Dependency Injection in .NET by Mark Seemann: http://www.amazon.com/gp/product/1935182501
on “Ask HN: What's the best technical eBook you have read?” ↗…author started it. For context, when I first became aware of the Mark Seemann, he was very deep into the object-oriented way of doing things. I discovered him because he was the author of (the excellent) Dependency Injection in .NET. A while after writing that book, he started getting into F#, and eventually Haskell, and blogged about it all the while. The upshot being, his blog archive now tells a fascinating story of the evolution…
on “From Design Patterns to Category Theory (2017)” ↗Dependency Injection in .NET by Mark Seemann was the trigger that started my transition from someone basically writing "script spaghetti" in an OO language to someone that could actually decompose a conceptual set of processes into…
on “Ask HN: What books had the greatest effect on how you structure your code?” ↗I strongly suggest "Dependency Injection in .NET" by Mark Seemann, regardless of whether or not you're a .NET dev (if you understand basic OOP, C# syntax is generally pretty easy to pick up on). Really the main reason it's "... in .NET" is because…
on “Ask HN: What's the most simple thing you struggle to understand in programming?” ↗Mark Seemann, TFA's autor wrote a highly praised book Dependency Injection in.NET and then slowly gravitated towards F# and Haskell. He presents lot of perspectives on FP often in the context of OO alternatives making it easier to appreciate FP advantages not just in theory, but in…
on “From design patterns to category theory” ↗…Tools, Aho http://amzn.to/2rCSUVA Computer Systems: A Programmer's Perspective, O'Hallaron and Bryant http://amzn.to/2qPY5jH Data Flow Analysis: Theory and Practice, Khedker http://amzn.to/2qTnSvr Dependency Injection in .NET, Seemann http://amzn.to/2rCz0tV Domain Driven Design, Evans http://amzn.to/2sIGM4N Fundamentals of Wireless Communication, Tse and Viswanath http://amzn.to/2rCTmTM Genetic Programming: An Intrduction,…
on “Ask HN: What language-agnostic programming books should I read?” ↗I've really enjoyed "Dependency Injection in .NET"- despite the name, the book itself is really 95% about Dependency Injection and relatively language agnostic. It exhibits a bottom-up approach to using inversion of control in a way that makes sense…
on “Ask HN: What language-agnostic programming books should I read?” ↗> "WARNING As a rule of thumb, enums are code smells and should be refactored to polymorphic classes. [8]" Seemann, Mark, Dependency Injection in .Net, 2011, p. 342 Gosh, what a load of baloney from a frog in a well.
on “When are enums not a code smell?” ↗> direct DI—as in, passing dependencies to things Mark Seemann called it "poor man's DI" in the first edition of Dependency Injection in .NET and changed it to "pure DI" in the second edition, but "direct DI" might be a better term.
on “Why and how to use service injection in Node.js” ↗It's a big ask to suggest reading through this, but reading http://blog.ploeh.dk starting from around about 2013 is illuminative. Seemann basically wrote the book on dependency injection in .NET, and has been a pretty big evangelizer for clean object-oriented design. Some time during that year, though, he discovered F#, and from 2014 on his blog has been increasingly about functional rather than…
on “A Bit of Heresy: Functional Languages Are Overrated (2010)” ↗