this post was submitted on 09 Jun 2024
230 points (79.6% liked)
> Greentext
7584 readers
3 users here now
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Always seems like you have to reinvent the wheel in .NET and I'm missing something. Is there a nice set of ready to go libraries like Spring Boot?
I get the sense that’s what .NET itself is meant to be
It’s a very insular ecosystem IMO, and the lines between .NET, C# and Visual Studio are very blurry
aspnet core is the library you want
Simple and just works
Randomly selected something from a project I'm working on that's simple and just works. Show me less than 300 lines of .NET to do the same, and I would be somewhat surprised.
Well with your mild surprise on the line the stakes couldn't be higher
I know C# works, it pays my bills so that's good enough for me.
Here's a good place to see what it can do:
https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-8.0&tabs=visual-studio
I am familiar.
Not saying don't pay your bills with it; that part sounds great. I was just confused by this guy's enthusiasm for it, that's all.
Well, for starters, it's a greentext, so who knows how genuine it is, right? Most of the points listed are either subjective or citation needed fodder. However, maybe there's one fact I can bring to the table:
ASP.NET's benchmark performance ranked 16th in Round 22 of the TechEmpower Web Framework Benchmarks, ranking below solutions written in Rust, C, Java, and JS. C# has advantages over each of those languages and frameworks in exchange for the relative loss in performance. Rust and C are much lower level. Java's syntax is generally considered to lag behind C#'s at this point. JS's disadvantages could fill a whole post of their own. C# and .NET have their own disadvantages (such as relatively fewer libraries available) as you've pointed out in this thread and another in this post, but when you take into consideration the relatively high performance while being a strongly-typed higher-level language with plenty of nice QoL features, you might be able to see why it could be attractive to a specific slice of professionals.
You left out the hundred of lines from the library you're importing. Where's all the code for robotparser?
You can import libraries with C# too. That says nothing about the differences between languages.
That's exactly my point though - part of my assertion of a big weakness in C# would be that more mainstream languages (python or node) have massive libraries you can draw on with existing code for simple stuff like parsing robots.txt, whereas C# has one that probably seems pretty luxurious if you're comparing it to nothing, but is well short of what OSS programmers are accustomed to.
So yeah it's not a purely fair language-design comparison but it's a perfectly fair "how easy is it to get stuff done in this language" comparison. And then at a certain point it starts to become not just a convenience but a whole new area of computation (something like numpy or pytorch) that's simply impossible in C# without a whole research project devoted to it to implement. That said, I'm sure there are areas (esp in heavily business-oriented fields like airline or medical backend or whatnot) where it's the other way around, of course, and you have C#-specific stuff for that domain that would be real difficult to replicate in some other environment. I'm not trying to say that side doesn't exist, just saying what's generally applicable to my experience.
So I'm not like being critical of C# because of language features (it seems perfectly fine and functional; I get what the people are saying who say they get work done every day in it and it seems fine.) But also, I think it's relevant that it's missing some big advantages if you're trying to go beyond the "it doesn't actively punish you for using it" stage.
In .NET to make a controller you just make a class that extends controller and then a public function that returns a ViewResult, JsonResult, etc.
No black box dependency injection required.
It can be even simpler than that. With the so-called “Minimal API” framework lets you define an entire web app with simple functions. This article shows some samples of what it looks like to create a web app in this style.