305
Anon discovers .NET (programming.dev)
submitted 3 months ago by starman@programming.dev to c/greentext@lemmy.ml
top 50 comments
sorted by: hot top controversial new old
[-] mozz@mbin.grits.dev 130 points 3 months ago

What on earth is this gibberish

[-] Potatos_are_not_friends@lemmy.world 73 points 3 months ago

A weird ass Microsoft ad.

I work with .net developers. It scarred them so deeply, don't even like to program outside of work anymore.

[-] mozz@mbin.grits.dev 25 points 3 months ago

Yeah

I could maybe see it, if all you know otherwise is C++, and your experience with other languages is trying to make python / go / node / whatever work well on a Windows machine without well-working tooling, and then you finally try C# and it's like oh shit, it's not filling up my mouth with feces every time I want to iterate over a dictionary or need memory management, this is a big improvement, I like it

But, VSCode has good support for those other languages now anyway

And, the bigger question, who the fuck are all these people upvoting this

Like what do you guys do all day? Or is this some subtle super sophisticated joke I am not understanding, or do you just like the man's chin? Or do you just not program and you upvote programming things out of general excitement about the idea of doing programming?

Who in the fuck is this excited about C# of all the things in the world to get excited about?

I'm just baffled in general by it

[-] JustAnotherRando@lemmy.world 19 points 3 months ago

I work in C# and I find it highly preferable over working in Java or C++.

[-] mozz@mbin.grits.dev 8 points 3 months ago

Yeah. That’s what I was saying - it is clearly superior to C++ and probably to Java but those are like the worst two languages in the meta. It’s like hey this is a clear improvement over what we were doing 40 years ago that’s acknowledged by everyone has aged poorly.

Idk man, I’m not trying to be bigoted about it just saying my experience is more pleasant with a few other languages available outside of that grouping.

[-] JustAnotherRando@lemmy.world 7 points 3 months ago

It very much depends on what you're trying to do. C# is pretty great for developing APIs, especially in an enterprise environment involving a lot of business logic. I don't have much of an opinion on Django as I haven't spent enough time looking into it, but I have looked at enough Node.js code to know I don't prefer it for most of the projects I've been involved in.
My Python experience is largely based in working with things like Raspberry Pis, and relatively simple jobs where Python made the job pretty easy. I don't know enough experience with larger Python projects to have a feel for what good architecture in a complex application looks like.
With C#, I can go into a large application using good practices and quickly navigate the code and be productive.

[-] mozz@mbin.grits.dev 3 points 3 months ago* (last edited 3 months ago)

APIs

enterprise environment

business logic

...

Must be why all those tech focused companies, Google and Facebook, Netflix, Amazon, IDK, whatever list you want to put together, rely so heavily on C# for all their core enterprise API functionality. (I actually found a list. I'm not saying that it's automatically that something being popular means it's good, but I think if C# had inherent advantages over other more modern solutions then it would be somewhat more heavily represented in top-tier production software systems.)

As far as I can tell, C# doesn't really have any real advantages over other more modern environments aside from a certain cachet of "enterprise" in some sectors which is often convincing to non-technical people, which I assume is what you're trying to invoke here. I think it's missing some strong advantages in those environments that something like Go would provide.

I have looked at enough Node.js code to know I don't prefer it for most of the projects I've been involved in

100% agree, I actually actively don't like Node for a few different reasons. I mentioned C# not having many advantages in my opinion; Node has some active disadvantages.

With C#, I can go into a large application using good practices and quickly navigate the code and be productive.

I mean I think mostly what you're saying here is that you're familiar with it, and it's suitable for large systems. Which, sure, I get that and it makes sense, but it's also not the only production language that someone can get familiar with, and at this point I think it's missing some important features as compared with some of its peers (easy concurrency handling, good portability, and massive availability of libraries being some I could pick out).

Like I say I'm not trying to tell you you're wrong for using it if you're happy with how it solves your problems and the codebases you can create in it. I'm just saying that may have less to do with its technical features as compared with other languages and more to do with some other factors instead.

load more comments (3 replies)
[-] Sanctus@lemmy.world 3 points 3 months ago

I'm assuming since this is greentext a lot of people seeing this don't work with code every day. I definitely don't work with it every day, only reason I know .NET is a fistful of fireants is from the few programs I have made for my company.

load more comments (4 replies)
load more comments (2 replies)
[-] Static_Rocket@lemmy.world 103 points 3 months ago

A thinly veiled M$ ad, trying to save face after the .NET fiasco of 2021...

[-] virku@lemmy.world 30 points 3 months ago

Tell me more about the .NET fiasco of 2021?

[-] Static_Rocket@lemmy.world 70 points 3 months ago* (last edited 3 months ago)

Microsoft tried to lock a development feature behind a paywall by introducing an artificial dependency on Visual Studio.

This also happened to occur right around the time there were also licensing and hosting issues around open source libraries. The manipulation of the .NET foundation was the really concerning part. Made it clear that MS still doesn't give a damn about the wider community using their language.

[-] AAA@feddit.de 11 points 3 months ago

Everything I don't like is an ad.

Seriously. People. Get off your high horses. It's a fucking greetext of someone liking something.

load more comments (2 replies)
[-] anas@lemmy.world 6 points 3 months ago

the long con, wait three years and nobody will suspect your ads

[-] anus@lemmy.world 78 points 3 months ago* (last edited 3 months ago)

pervasive unchecked nullability

Framework management is hell, fat binaries inconvenient and not default

No option monad in the standard lib

Cross version dependencies simply don't work in some contexts

Compiler output only marginally better than working with c++

At least it doesn't have Gradle.

[-] Amir@lemmy.ml 18 points 3 months ago

pervasive unchecked nullability

Addressed nowadays with the question mark and exclamation mark syntax, and programming without nullability is a pain

Framework management is hell, fat binaries inconvenient and not default

Nuget?

Compiler output only marginally better than working with c++

No one claims it's faster at runtime than good C++, it's just a lot easier to write decent code

[-] bhamlin@lemmy.world 6 points 3 months ago

Compiler output only marginally better than working with c++

No one claims it's faster at runtime than good C++, it's just a lot easier to write decent code

I think they're referring to warning and error content. Compared to things like rust, deciphering error notifications from the c# compiler can sometimes feel like trying to figure out what a child with limited vocabulary is trying to tell you.

Even with decades of personal experience with it, they can be confusing and non-informative sometimes for me.

load more comments (1 replies)
[-] kogasa@programming.dev 4 points 3 months ago

Nullable reference types are (a completely mandatory) bandaid fix in my opinion as a .net dev. You will encounter lots of edge cases where the compiler is unable to determine the nullability of an object, e.g. when using dependency injection to populate a field, or when using other unusual control flows like MediatR. You can suppress the warnings manually at the slight risk of lying to the analyzer. Objects supplied by external library code may or may not be annotated, and they may or may not be annotated correctly. The lack of compile-time null checking is occasionally an issue. But that said, NRT makes nullability a significantly smaller issue in C# than it used to be

[-] AdamBomb@lemmy.sdf.org 10 points 3 months ago

Null reference checking by the compiler is enabled by default in new C# projects.

C# doesn’t come with an option monad in its standard library, but its cooler sibling F# does.

load more comments (6 replies)
load more comments (2 replies)
[-] Zimeron@lemmy.world 40 points 3 months ago

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?

[-] FrostyCaveman@lemm.ee 23 points 3 months ago

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

[-] Pencilnoob@lemmy.world 16 points 3 months ago

aspnet core is the library you want

Simple and just works

[-] mozz@mbin.grits.dev 5 points 3 months ago

Simple and just works

    def fetch_html(self, url):
        domain = urllib.parse.urlparse(url).netloc
        if domain not in self.robot_parsers:
            rp = urllib.robotparser.RobotFileParser()
            rp.set_url(f'https://{domain}/robots.txt')
            rp.read()
            self.robot_parsers[domain] = rp

        rp = self.robot_parsers[domain]
        if not rp.can_fetch(self.user_agent, url):
            print(f"Fetching not allowed by robots.txt: {url}")
            return None

        if self.last_fetch_time:
            time_since_last_fetch = time.time() - self.last_fetch_time
            if time_since_last_fetch < self.delay:
                time.sleep(self.delay - time_since_last_fetch)

        headers = {'User-Agent': self.user_agent}
        response = requests.get(url, headers=headers)
        self.last_fetch_time = time.time()

        if response.status_code == 200:
            return response.text
        else:
            print(f"Failed to fetch {url}: {response.status_code}")
            return None

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.

[-] Pencilnoob@lemmy.world 3 points 3 months ago

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

load more comments (2 replies)
load more comments (2 replies)
[-] masterspace@lemmy.ca 6 points 3 months ago

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.

[-] AdamBomb@lemmy.sdf.org 4 points 3 months ago

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.

[-] EnderMB@lemmy.world 28 points 3 months ago

IMO C# is at the point where Java can probably just die. I don't see a point in keeping Java when C# is a viable option in many use cases.

[-] grue@lemmy.world 24 points 3 months ago

I'm sure Microsoft will be happy to know their EEE strategy is finally paying off, only two decades late.

[-] Blue_Morpho@lemmy.world 23 points 3 months ago

Oracle owns Java and has made its proprietary hold on the language clear.

There are no good guys here.

[-] EnderMB@lemmy.world 9 points 3 months ago

It's attitudes like this that made me choose C# as the language I wanted to use professionally after graduation.

Having grown up in the Slashdot era where people would be childish, post about Micro$oft, and parrot EEE, all while the .NET Foundation consistently put out great tooling with a mature community that actively wanted to help you learn the language/framework, the choice was simple.

[-] GissaMittJobb@lemmy.ml 19 points 3 months ago

I don't think this line of reasoning is strictly speaking correct, but assuming it was, then I think it would follow that Kotlin exists and as such C# does not need to be kept around.

[-] audiomodder 9 points 3 months ago

Compiled Java is still cross-platform. It’s been a few years for me, but when I last worked in C# it was a giant PITA to work on it in Linux or MacOS. I hope it’s gotten better.

[-] vithigar@lemmy.ca 7 points 3 months ago

.NET (not .NET Framework) is cross platform and can be compiled into native binaries on a variety of platforms. There is however the wrinkle of not all the libraries within .NET being supported on all platforms. Most notably, everything involving a graphical UI is Windows only.

The most well known cross platform .NET project you probably have heard about is Jellyfin.

load more comments (1 replies)
load more comments (2 replies)
[-] Pencilnoob@lemmy.world 20 points 3 months ago
[-] Varyk@sh.itjust.works 10 points 3 months ago

Do you know why sharp is added to the end of programming languages? Like c sharp and f sharp?

Actually, I don't even know if it is pronounced c sharp or f sharp. I just assumed it was the same as music.

[-] starman@programming.dev 33 points 3 months ago

Do you know why sharp is added to the end of programming languages? Like c sharp and f sharp?

There was (and still is) a language called C. Then C++ was invented. And then C#, maybe because # looks kinda like 4 pluses.

There is also another programming paradigm, called functional programming. F# is a functional programming language and runs on the same platform as C# (that platform is called .NET). That's why they named it F#.

Actually, I don't even know if it is pronounced c sharp or f sharp. I just assumed it was the same as music.

Yes, it's pronounced see sharp.

[-] Varyk@sh.itjust.works 6 points 3 months ago

Very cool, thank you for explaining that.

[-] starman@programming.dev 8 points 3 months ago

No problemo

[-] dank953@lemmy.world 7 points 3 months ago

a sharp symbol is ++ stacked on top of ++ So C ++ ++ becomes C#

Phonetically, It is C sharp because it sounds cooler than C hash or C pound.

[-] Hawke@lemmy.world 15 points 3 months ago

Also because in music, C# is a half-note higher than C.

[-] Varyk@sh.itjust.works 3 points 3 months ago

Rad. Thanks! What do the pluses denote in a programming language? What's the difference between c+, c++ and c sharp?

[-] lili_thana 16 points 3 months ago

++ is the increment operator in C, which increases a value by 1. C++ was intended to be an improvement on C, and so it's saying that C++ is C incremented. C# is C++ ++ or C++ incremented. It's just a bunch of programmer jokes. There isn't a C+ afaik.

[-] Varyk@sh.itjust.works 4 points 3 months ago

Oh, haha, got it. Thanks

load more comments (1 replies)
[-] orivar@lemmy.dbzer0.com 8 points 3 months ago

There is no c+. The reason is that ++ means "increment by 1" in c itself (and many other languages).

load more comments (1 replies)
load more comments (3 replies)
load more comments (2 replies)
[-] lung@lemmy.world 20 points 3 months ago

I guess I need glasses bc I can't C#

[-] Xylight@lemdro.id 20 points 3 months ago

i hate .net with a passion and will spent the rest of my life hunting down the inventor

[-] KingThrillgore@lemmy.ml 12 points 3 months ago

Runs on Windows, macOS, and Linux

I mean, you can't argue with that.

[-] vox@sopuli.xyz 7 points 3 months ago* (last edited 3 months ago)

i tried using c# for lower-level-ish tasks and it was even more painful than js (emulation development, specifically). who the fuck decided that all math operations should cast to int????

[-] Heavybell@lemmy.world 16 points 3 months ago

I program professionally in C# and I gotta say, it really isn't for that. You can do services in it, but that's as low level as I'd suggest. It's definitely a high level language for rapid dev of web and desktop stuff.

load more comments
view more: next ›
this post was submitted on 09 Jun 2024
305 points (100.0% liked)

> Greentext

7440 readers
32 users here now

founded 2 years ago
MODERATORS