Live data from Hacker News

.NET 5.0

devblogs.microsoft.com

331–340 of 466 posts

Re: .NET 5.0

#331

I used to be an asp.net developer before. I appreciated the idea behind asp.net during its early years - making websites fast and with templating (or scaffolding). Later realized that it is bloat. Then asp.net mvc happened, a whole new paradigm shift. But then I disliked the idea of stuff getting inherited from somewhere. *.cshtml files and all. Soon I realized what the ide is actually doing behind the scenes. For e.…

ASP.NET Core is build like Express. It's all just middlewares. You don't have to use the Razor View Engine. It's really worth another look.

Re: .NET 5.0

#332
post #203

Earlier quoted context omitted.

> There is no parallel work to be accomplished here. Concurrency is not parallelism [1]. [1]: https://blog.golang.org/waza-talk

Each HTTP request in a Go webserver spawns a goroutine, and there is no need to think about "freeing up threads" since coroutines are not OS threads. There's also no need to leak the word `async` all over your codebase. The problem being solved here with async/await is also being caused by async/await.

The issue is that Go simply does not allow large classes of system which require direct and unfettered access to the operating system primitives to be built.

I'm a huge fan of Go, but pretending the two systems are equivalent either is either disingenuous or belies misunderstanding.

Re: .NET 5.0

#333

Earlier quoted context omitted.

>but you also get a self-contained binary executing without the requirement of an external runtime environment. I'm not sure whether we're talking about the same thing, but you can publish Self-Contained App (basically your app and framework together) and you don't have to install anything.

This is technically true, but it's a difference of a 5 MB executable vs a 50 MB.

.NET has trimming now, so it is 5 MB? (Possibly less!)

Re: .NET 5.0

#334

Earlier quoted context omitted.

For simplicity? Just like how js get async await thing eventually.

I fail to see how this is sensible in the slightest - you then have to re-write the code if you want the application to scale. Otherwise you are wasting memory, trashing GC, spawning all these extra threads.All awaitable operations like network requests, disk reads, etc, should be async. Why would you write potato code?

you then have to re-write the code if you want the application to scale.

Scaling machines (VMs, containers) is a solved problem and very easy to do today.

Re: .NET 5.0

#335
post #304

Would most people here agree that .NET is a much better platform for developing applications with a plugin-based architecture (which, I think, more or less, implies following Hexagonal aka Clean Architecture / Ports and Adapters Pattern [1]) than popular alternatives (e.g., Python, TypeScript/Node.js) due to a diverse set of comprehensive dependency injection (DI) implementations [2]? While it is possible to use a ma…

The DI in .NET is really powerful and feels intuitive once you play around with it in a few different projects.

We have almost 100 services injected into .NET Core DI and it always feels very stable and manageable. For us, we cheated a little bit on many services and just take a dependency on IServiceProvider to get at other services at runtime. This allows for any service to talk to any other service without worrying about some monster CTOR hierarchy. We used to try to keep things "correct" in terms of dependency chain, but we have found that the real world is a lot easier to work with when you permit circular dependencies between services and maintain 1 big flat collection of them. This is basically microservices but without the RPC ceremony and associated nightmares.

Re: .NET 5.0

#336
post #45

Earlier quoted context omitted.

alternatives?

Express with Typescript feels pretty good in my opinion.

I can understand the preference for Node.js if you want to free yourself from the shackles of static typing but to then bolt-on Typescript doesn't make sense given that C# is a genuine statically-typed language. Last I looked Kestrel also ran rings round Node.

Re: .NET 5.0

#337

So, on the plus side with the new .net, I recently made a .net core web app on Linux, and generally it's been pretty easy. I'm also impressed at just how fast asp.net core is compared to asp.net, the time it takes to open your site in debug mode has dropped dramatically, from what used to be 1/2 minute in asp.net to a few seconds in .net core. On the bad side? Mainly the asp.net core team and their push for Dependenc…

You'd want your config injected so that you can swap out configs for test harnesses for continuous integration and deployment. It's one of the mainstays of making your software deployable by automation.

How is it that the big enterprise languages haven't gotten the ability to just mock imports yet?

There are certain benefits to DI, but this one seems more like a lack of tooling.

Re: .NET 5.0

#338

Earlier quoted context omitted.

> Azure will win you over from AWS every time. Going to have to disagree here. That might be the case if Azure was not literally a tire-fire. I have been using Azure for work and it's the most frustrating, inconsistent, often-broken, confusing and stress-inducing cloud service that my teammates and I have ever been subjected to. It left such a bad taste that I am quite certain I would flat-out refuse to use it again…

I've been using Azure for all of my projects for 5 years now, with zero problems.

If you do the Microsoft way. But i find their batteries included approach to be broken more often than not. Tried deploying a docker image with cors on azure. Literally could not do it because of bugs and the gsc that they were intercepting cors packets. Opened up 3 bugs took Months to fix one. It's a tire fire.

Re: .NET 5.0

#339

Earlier quoted context omitted.

> My biggest bugbear is the way you access your config, which is an absolute and utter kafka-esque mess. Because someone at MS was drinking the DI kool-aid you have to add a minimum of 5 lines of code to any class you want to access config values in I'm not sure if maybe you're referring to the Options stuff? The way I do it is pretty simple. 1. Create a POCO that represents your config. You can have properties for b…

I think the OP is referring to accessing the config 5 layers down from the controller. I've run into it myself. To be able to do that, you have to add Options to the constructor of every class in the chain and then configure DI for it. It just has bad code smell. On my last project, I just assigned the configs to a static class that's available everywhere and the code was just simply much cleaner.

Why does something 5 layers down need all the config values?

Re: .NET 5.0

#340
post #304

Would most people here agree that .NET is a much better platform for developing applications with a plugin-based architecture (which, I think, more or less, implies following Hexagonal aka Clean Architecture / Ports and Adapters Pattern [1]) than popular alternatives (e.g., Python, TypeScript/Node.js) due to a diverse set of comprehensive dependency injection (DI) implementations [2]? While it is possible to use a ma…

The DI in .NET is really powerful and feels intuitive once you play around with it in a few different projects. We have almost 100 services injected into .NET Core DI and it always feels very stable and manageable. For us, we cheated a little bit on many services and just take a dependency on IServiceProvider to get at other services at runtime. This allows for any service to talk to any other service without worryin…

Thank you very much for sharing your DI experience. What is wrong with using IServiceProvider dependency? What is CTOR (hierarchy)?
Post reply on HN