Hacker News new | ask | show | jobs
by HeyHoJoe 2048 days ago
Going off of the dot net core 5 release thread, I assume it’s because of misunderstanding or lack of familiarity with the platform. There was a very confused top level comment that seemed to be complaining about DI and dependency drilling down several layers. That’s just not using DI at all. In general DI is a great pattern that encourages lose coupling and testability, so I also don’t get the complaint.
1 comments

If you're talking about my comment, you couldn't be further from the truth.

I've actually worked with C# for over 15 years now and written apps with (in order of age) VBScript, webforms, web services (the MS SOAP stuff), MVC 1, MVC 2, MVC 3, MVC 4, Web API, Web API 2, the OData one I forget the name of and asp.net core. Oh and Silverlight. I've probably missed something. On yeah, WCF. And even WWF! Basically EVERYTHING web-related to C#. Plus enough work in PHP, Python, Ruby, Express, etc. to be able to compare different approaches. And even sometimes VB.net, I've maintained and then migrated entire code-bases from that to C#.

I'm not entirely sure what more familiarity I need?

I'd also note that there are a lot of other people agreeing with my in that thread, almost all of whom show a decent technical understanding. And it's got a lot of upvotes.

But, even if I "misunderstood" or have a "lack of familiarity", that speaks of how poor the design/documentation actually is. If you can so easily shoot yourself in the foot with it, it's not fit for purpose.

None of that is familiarity with DI, which wasn't as prominent or included in the framework itself until .NET Core. Perhaps it's just not a fit for you.
Ironically one project I joined and then worked on for 3 years used Unity, so I was already familiar with it.

Any other reasons you think I might be unqualified to talk about the language I've been using for 15 years?

Just to cover some more bases:

1. I've worked in teams

2. I've worked alone

3. I've made apps from scratch

4. I've maintained large existing code bases

5. I've made enterprise apps, e-commerce apps, BI apps, and even just simple websites

6. Millions of people have used my code

7. Apps I made over a decade ago are still being used today

8. I admit I often forget to floss

Again, none of that means familiarity with DI. Why deflect about the language? This has nothing to do with C#.

You never answered what your actual issue with DI is (the concept, implementation, containers, etc), or what your alternative would be, even though numerous people have asked. That makes your complaint seem largely unfounded or a combination of confusion and lack of experience with DI.

Not the OP, but I never used .NET core, but used DI pretty heavily for most of my 15 years writing C#. It was there before .NET Core. Maybe you mean it's improved with .NET Core?
"wasn't as prominent or included in the framework itself"

There was no built-in DI container before, you had to use your own like Windsor/Autofac/Ninject/etc, and it wasn't as popular because of it as many people skipped it for smaller/less enterprise projects. I'd say exposing more people do it, even if the built-in DI is rather basic, helped improve many new projects that otherwise might not have chosen to do so.

I don’t know if it was your comment, but you can tell me you’re the queen of Scotland for all I care. Just look at your complaint above in this thread about DI and how no one can make sense of it. If you have so much experience you hide it well.
Funny, I've just checked those comments and again, a bunch of people agreeing with me. Are you wearing your "I can only see comments that back my biases" glasses?

To me, it's clear that some people love DI. SOME. Use it if you want. I don't want to. Stop dictating what's "good" code to experienced developers.

If it helps you, fine, but it hinders me.

Yeah, I can see the thread just fine, I can also see the majority of posters and the more substantive posters disagreeing with you. Also the only person who comes close to dictating anything here is you.

And I’m still not seeing the benefit of all that experience by the way.