7

"C# is better than JavaScript"

I only see ruminations of people who are so far gone mentally they can't even see the forest from the trees anymore:

https://stackoverflow.com/questions...

Imagine having 100s of garbage ways to choose from for something that should have trivial built-in functionality.

🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡🤡

oh and don't give me the shit "enums are bad pattern" grow up and learn to code

Comments
  • 5
    now imagine having 100s or ways to choose from and none working - that's js..

    c# IS better than JS, because everything is better than js ;)
  • 4
    I partly agree, but probably for different reasons.
    C# has an absurdly high number of collection types which all do practically the same but have little subtle differences.
    Most of the problems come from the fact that all collections are reference types so you need at least two copies to have mutable and immutable ones. This multiplies with all the other variants such as thread safety, async, etc.

    JS has kind of the opposite issue: it has practically only one collection type (actually two: array and dictionary/object) but that one has reference semantics as well and it lacks the flexibility of all the other stuff such as the ability to make it immutable or thread safe.

    What’s the solution then?

    Make collections value types like Swift does.
    This allows to declare variables of collection types as constants (immutable) and the collection becomes immutable as well, naturally without the need for extra types.
  • 3
    @Lensflare clarification: the differences between the collection types is how they're implemented internally, reflecting how they behave and how they perform in different scenarios.

    and when in doubt, you can just use a list and be done with it ;)
  • 1
    @tosensei true, but it only works in a small isolated context like when you implement a function or something.
    As soon as you need to use some sdks, libraries or even other parts of your own code, you will need to deal with those types as they appear in the interfaces and method signatures.

    For example there is no need to have Array, List and ArrayList. I know all the details and differences about them but as a dev, you shouldn’t be bothered to decide which one to use. In practice it won’t ever make a difference unless you have huge amount of elements.
  • 0
    @tosensei

    Prior to being a Swift dev, I thought that it’s important to have the choice and that it’s what makes a good dev to know the difference.
    This opinion has changed as I realized that a single collection type like Swift’s Array can be implemented to have all of the convenience apis that you need and is also highly optimized and does the right and performant thing on search/insertion/whatever.
    And that is true even before we evaluate the advantages if it being a value type.
  • 0
    what's the JS way of doing this?
  • 1
    @iceb typescript string enums :)
  • 1
    @fullstackcircus I don't get it. that's like declaring

    constants in c#? I don't see how this makes JS better?
  • 1
    @jestdotty it is indeed easy to write anything in js. Especially bugs.
  • 1
    c# market share is merely a statistical error compared to js market share. there is a reason for that — js is a superior language. if it wasn't, it would've been replaced by things like dart long ago already.
  • 2
    @kiki i thought you were cool, but it seems you're infected with stockholmJS as well.
  • 0
    @kiki I think that has more to do with marketing than anything else.
  • 1
    @tosensei @iceb can’t handle facts. You simply cannot force the whole dev world of people talented enough to create rust, zig, other gems, to use “crap” language for 27 years straight, actively developing it, introducing new features every year. That’s flat earth level shit
  • 1
    @kiki that’s the classic bandwagon fallacy.
    Do you really believe that the quality and validity of something depends on its popularity?
  • 0
    @kiki I mean by that logic. Perl is better than JS?
  • 0
    @kiki the only reason why js is so popular is because it’s very accessible and is the monopoly language for the browser.
  • 0
    @Lensflare in general, no. in certain areas, definitely yes. forcing queerwashed marvel/hollywood bs down lazy consumers' throats is one thing. having the entire vibrant field of really really talented people that CAN change things if they want to (we've seen it already) STILL using js and IMPROVING it means something. It's just a better language. deal with it.
  • 0
    @iceb perl is not developed as rapidly as js. it has less funding and less interest from the community. there are less perl devs than js devs out there.
  • 2
    @kiki Another reasonable explanation for the huge market share of would be that it is THE browser scripting language. This leads to many people getting exposed to it - and since they most likely already have a browser and text editor installed, it is also very easy to get started.
  • 0
    I mean mighty GOOGLE that HAS browser monopoly tried to replace js with dart and failed. it's really hard to fundamentally improve js, but it's easy to mess it up — look no further than es4.
  • 1
    @kiki the only thing that I agree with is that in certain cases, popularity and quality do correlate. Not in the case of JS though.
    It’s not the better language, it’s the only language. Wasm may change that.
  • 1
    @Lensflare > "C# has an absurdly high number of collection types"

    Amen.

    And the pissing contests I've seen between devs.

    "You should be using IEnumerable!!" "No! You should be using KeyValuePair!!!" "Tuples! Tuples everywhere!!!"

    Dare to speak up "Guys, users don't care and it doesn't really matter.", then bombarded with contrived "benchmarks" proving X is better than Y.
  • 0
    @Lensflare wasm doesn't have DOM access. without it, accessibility on the web is out of the window, and with the general leftist sentiment in the EU, you can't ignore web a11y.
  • 2
    Well. everyone has their own measuring sticks.

    I like c# and I look up to Jon Skeet. And that's enough for me.

    Still interested in the discussion though
  • 3
    @kiki the reason why google failed is not because js is the better language but because it is an established monopoly with huge momentum which is insanely hard to dethrone.
  • 1
    also, guys, you do realize I was a C# teacher? do you?

    I'm getting old. I'm not as attracted by shiny promises as I once was. being stupid and gullible, I chose react and wasted several precious years of my YOUTH, not just my life, on this crap. it's over now.

    js is a nuclear resistant cockroach that will outlive whatever you're using rn, except for c (definitely) and php (maybe). this is not touching declarative things like sql.

    I'm willing to listen to C guys, sql guys, even php guys — people whose skills and experience will be valid 30 years from now. C# people? I don't give a flying fuck what you think and what you believe in. You might be interesting as a person, and I'm willing to talk about something personal, but not about programming. with all due respect.
  • 1
    @kiki wasm not having dom access is also exaclty the reason why it struggles to replace js. And js having dom access doesn’t make it the better language.
  • 0
    @Lensflare what you say is valid. yet, I never said js was better BECAUSE it had dom access.
  • 3
    @kiki I kind of get your opinion about C#. And that is why you definitely should take a look at Rust and Swift. It’s like all advantages from JS, C++ and Haskell combined.
  • 1
    @kiki what is your definition of better then?
  • 1
    Typescript is one hell of a thing.

    C# is an awesome OOP language too.

    Just write in whatever you need/makes you happy

    Why the drama?
  • 2
    @MaNaNa not necessarily drama. As professionals we can surely discuss pros and cons of different languages without being insulted and fighting each other?
  • 2
    I think all languages have their upsides and their downsides. Even though I hated working with C# at my work (Mostly because all the codebases tended to be either legacy quickly hacked together code, or tended to be extremely overengineered for no reason), but somehow I do kind of miss it. Its very clear and if used right, can definetly be very strong. I'm now fulltime working with JS/TS and they have their own quirks, just like C#. All languages are different, yet somehow they are also the same ;)
  • 0
    @iceb dude. you literally asked how to do this in JS and i answered how. then you say you don't understand. what are you even talking about bro
  • 2
    for what seems like a long while, i find myself agreeing with @kiki in this thread... strange...
  • 0
    @fullstackcircus I mean I don't understand your point.

    You are complaining about c# and it's complicated when there's built in methods in JS then you showed an example that isn't any different from c# code (at least from what I understood)

    I don't get your point.
  • 2
    @Lensflare the language itself is very accessible to use

    It's easy to start hard to expert video game, the perfect difficulty slope

    Though big codebases maybe shouldn't. And all the libraries get outdated too fast. And the js people changing require/imports annoyed me and that's kind of a mess now... I think just modern developers kind of suck. Es6 was pretty perfect though

    Been so long since I used any other language indepth though, so I don't even know if the large codebase problem is necessarily going to be fixed leaving js but I hope it will
  • 3
    @Lensflare Regarding collection types in C#: They do have quite different behaviour and which to pick depends in the use case. However this is mostly about internal behaviour and libraries should usually expose them through an appropriate interface.

    For example IEnumerable and IList have very different guarantees and distinguishing between them can be very useful. I work with datasets that can get quite large and writing them to a list instead of directly iterating through them is just not a great idea.

    Using the right tool for the job and all that.. Which applies here towards the choice of collection type but also the language ;)
  • 0
    @Slow-Yep you can build anything with js, just like you can build anything with brainfuck. That’s not a miracle. It’s called turing completeness.

    Real devs will never accept js as a good programming language.

    You can whine about it or you can adapt.
  • 0
    @Slow-Yep I didn’t call myself a real dev. But you are right, "real dev" is not the correct term. "self-respecting dev" or "dev with dignity" might have been fitting better.

    See? This is how you take advice.
  • 0
    @Slow-Yep nah, you misunderstand again. I’m not talking about me but about devs in general. I’m not special, you are.
  • 0
    @Slow-Yep dude you changed my text in your quote to literally have the opposite meaning. I said that I’m talking about devs in general. Read it again and learn how to quote.

    Also I don’t and never did tell you how to do your job. All I ever did is pointing out how incredibly stupid you are, purely based on what you write, now what your job is or how you do your job.
  • 0
    @Slow-Yep I clarified that so many times before but I’m sure that you’ll forget it again, or won’t understand it and will complain again a few days later. It’s sad.
Add Comment