• mozz@mbin.grits.dev
        link
        fedilink
        arrow-up
        24
        arrow-down
        4
        ·
        5 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

          • mozz@mbin.grits.dev
            link
            fedilink
            arrow-up
            9
            arrow-down
            3
            ·
            5 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
              link
              fedilink
              arrow-up
              7
              arrow-down
              3
              ·
              5 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
                link
                fedilink
                arrow-up
                3
                arrow-down
                1
                ·
                edit-2
                5 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.

                • Kogasa@programming.dev
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  5 months ago

                  C# isn’t really the go-to for high scale distributed systems. But it’s extremely easy for a small team of developers to set up a really solid service really quickly. I don’t have experience with Go so I can’t really compare, but I find ASP.NET Core very pleasant to work with, and I also appreciate the suitability of C# and .NET libraries for both backend and frontend work.

                • JustAnotherRando@lemmy.world
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  5 months ago

                  So I don’t think it’s the only solution, or that anyone that doesn’t care for C# is wrong or anything like that, but it is a suitable language for large segments of development and is both a good career and, in my opinion, rather pleasant to work with. Looking at the languages listed in that list you shared, I see a lot of C, C++, and Java, which I have no interest in working in again unless i have a good reason for it. The other languages there are fine but I never had a big interest in Go (Google’s language) - it seems fine, but in my area I don’t think there’s much of a community around it.
                  The .NET community is pretty active where I live which is a plus, there are lots of jobs in the language and lots of professionals that are proficient in it. I’m going to try to avoid sharing too specific of information, but I’ve used C# in industries from healthcare, to automotive, to HR, to fitness. There are absolutely no shortage of companies using the technology - according to Statista, it’s the 8th most popular language, and they are including SQL and bash in that listing. I’m not sure I believe that data, but it was the first result I clicked in a very quick Google search.
                  I agree that popular != good, but if we are going to use “what companies are doing,” there are clearly plenty of people that have found it to be the right choice for their projects.
                  I will say that if your last exposure to .NET was like 5-10 years ago, it’s worth taking a look at what it offers now - not necessarily to use it yourself but to at least understand that it does bring a lot to the table. I tend to see a lot of people that make references to C# as it related to .NET Framework (e.g. “you have to use Windows”) that haven’t been the case since .NET Core came out in 2016. I will absolutely agree that it’s not always the right choice and there are aspects to the .NET world (Microsoft has the most obnoxious versioning - .NET Framework up to 4.x -> .NET Core up to 3.1 -> .NET 5 up to 8). And I fully get not wanting to work on it because it’s Microsoft because everyone has their brands that want as little to do with as possible, but it is a good object oriented language.

        • Sanctus@lemmy.world
          link
          fedilink
          English
          arrow-up
          3
          ·
          5 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.

          • Hawk@lemmy.dbzer0.com
            link
            fedilink
            English
            arrow-up
            2
            arrow-down
            1
            ·
            5 months ago

            Makes me wonder what kind of programs you make? Work with C# everyday, never really run into problems unless you’re working with the deeper Windows layers.

            • Sanctus@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              edit-2
              5 months ago

              I literally said I don’t work with it every day. I program the odd times every few months my company needs something automated now

              • Hawk@lemmy.dbzer0.com
                link
                fedilink
                English
                arrow-up
                1
                arrow-down
                1
                ·
                5 months ago

                So your problem with C# is that you don’t have the skill to use it? Unsure how else to interpret it?

                • Sanctus@lemmy.world
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  5 months ago

                  Actually I find C# to be quite nice. Its what I’m most familiar with and I’ve used it on my personal time to make some shitty games. Dont know what your issue is but you aren’t C# and dont need to take this personally.

    • Blaze@reddthat.com
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 months ago

      If C# is so good, where is the C# Lemmy/Mbin/Sublinks/Piefed alternative everyone has been waiting for?

      • Kogasa@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        Despite .NET being relatively friendly with Open Source, Java will probably remain the first choice for FOSS devs for a while, if only due to history and traction. You could write a C# Lemmy alternative, but it wouldn’t necessarily be faster or simpler or better in any particular way than a Java version. I’d certainly rather contribute in Java than start from scratch in C#.

      • Static_Rocket@lemmy.world
        link
        fedilink
        English
        arrow-up
        72
        arrow-down
        2
        ·
        edit-2
        5 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
      link
      fedilink
      arrow-up
      11
      arrow-down
      6
      ·
      5 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.

  • anus@lemmy.world
    link
    fedilink
    arrow-up
    79
    arrow-down
    3
    ·
    edit-2
    5 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.

    • ඞmir@lemmy.ml
      link
      fedilink
      arrow-up
      18
      arrow-down
      3
      ·
      5 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

      • Billegh@lemmy.world
        link
        fedilink
        arrow-up
        6
        ·
        5 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.

        • anus@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          5 months ago

          Yes this is right. C++ in this context is the boogeyman worst possible scenario. C# only being a little better just means it’s not actual garbage

      • Kogasa@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        5 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
      link
      fedilink
      English
      arrow-up
      10
      arrow-down
      1
      ·
      5 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.

        • anus@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          5 months ago

          Good idea, then patch the whole standard library and dotmet framework and most popular libraries to use that tiny library

        • AdamBomb@lemmy.sdf.org
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          2
          ·
          5 months ago

          Yeah, 100%. I don’t really recognize the complaint that “it isn’t in the standard library” as being super valid. If you know what an option monad is and you want to use one, you can certainly create one. Lots of people don’t know what it is and won’t miss it, especially in this context since the option monad is a functional construct and C# is an objects-first language.

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 months ago

      No Gradle

      I have such a love hate relationship with Gradle… I forget exactly what but there was something Maven couldn’t do that made me first try Gradle locally. I didn’t use it professionally for so long.

      Now that I am using it professionally, I’m not sure it’s better. Maybe it’s just a case of “grass is always greener on the other side” sort of thing.

      Some of my gripes,

      1. The documentation is almost really useful, but as soon as you have to look at Gradle’s Javadoc it’s a mess.
      2. I like the kotlin stuff better than groovy but a lot of old guides still use groovy and sometimes it is very confusing trying to translate.
      3. Why the hell does IntelliJ Idea Professional version still not give me code hints for Groovy Gradle files???
      4. I love that everything is customizable, but I think slightly more concrete conventions would be useful a lot of times. Or at least documenting the conventions somewhere.
      5. Why is it so hard to get the Maven BOM experience? There’s always fucking edge cases. Plus, why can’t I do it with plugins too?
      6. Why is there no “task tree” by default? Why isn’t this part of Gradle? https://github.com/dorongold/gradle-task-tree
      7. Why the fuck is JPMS so confusing? This is probably not really Gradle’s fault but still.
      8. Why is upgrading the wrapper so complicated? I have to do two invocations and get the version string myself.
  • Zimeron@lemmy.world
    link
    fedilink
    English
    arrow-up
    41
    arrow-down
    10
    ·
    5 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
      link
      fedilink
      arrow-up
      23
      ·
      5 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

      • mozz@mbin.grits.dev
        link
        fedilink
        arrow-up
        6
        arrow-down
        2
        ·
        5 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.

          • mozz@mbin.grits.dev
            link
            fedilink
            arrow-up
            1
            arrow-down
            1
            ·
            5 months ago

            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.

            • AdamBomb@lemmy.sdf.org
              link
              fedilink
              English
              arrow-up
              1
              ·
              5 months ago

              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.

        • ShortFuse@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          5 months ago

          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.

          • mozz@mbin.grits.dev
            link
            fedilink
            arrow-up
            3
            arrow-down
            1
            ·
            5 months ago

            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.

    • masterspace@lemmy.ca
      link
      fedilink
      English
      arrow-up
      6
      ·
      5 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
        link
        fedilink
        English
        arrow-up
        4
        ·
        5 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
    link
    fedilink
    arrow-up
    27
    arrow-down
    5
    ·
    5 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
      link
      fedilink
      English
      arrow-up
      24
      arrow-down
      4
      ·
      5 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
        link
        fedilink
        arrow-up
        23
        arrow-down
        1
        ·
        5 months ago

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

        There are no good guys here.

      • EnderMB@lemmy.world
        link
        fedilink
        arrow-up
        9
        arrow-down
        6
        ·
        5 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
      link
      fedilink
      arrow-up
      20
      ·
      5 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@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      10
      arrow-down
      1
      ·
      5 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
        link
        fedilink
        arrow-up
        7
        ·
        5 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.

      • JustAnotherRando@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        5 months ago

        Modern .NET (i.e. .NET Core and later) is cross platform. In fact, .NET APIs now are routinely run in containers not based on Windows.

      • Kogasa@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        5 months ago

        It’s a lot better with some notable exceptions. First, .NET Core is multiplatform by design, so it is by default quite portable. The .NET Core CLI is extremely powerful and means a CLI workflow is totally feasible (and also simplifies CI pipelines). The new “multiplatform” application framework, MAUI, runs on Windows, Mac, iOS, and Android, but not Linux/GTK/QT etc. You can maybe attribute this to the design philosophy of abstracting native controls, of which “Linux” itself has none, but either way it’s useless on Linux. Third party frameworks like Avalonia do work very well on Linux.

    • Varyk@sh.itjust.works
      link
      fedilink
      arrow-up
      10
      ·
      5 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.devOP
        link
        fedilink
        English
        arrow-up
        33
        ·
        5 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.

      • dank953@lemmy.world
        link
        fedilink
        arrow-up
        7
        arrow-down
        1
        ·
        5 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.

  • Xylight@lemdro.id
    link
    fedilink
    English
    arrow-up
    21
    arrow-down
    5
    ·
    5 months ago

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

    • proton_lynx@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      6 days ago

      I read the post and thought to myself “am I the only one who hates .NET?”. Glad to know that I’m not the only one. Count me in on that hunt bro.

  • voxel@sopuli.xyz
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    edit-2
    5 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
      link
      fedilink
      English
      arrow-up
      16
      ·
      5 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.