66

"Fuck JavaScript, its such a shitty language" seems to be quite a common rant today. It seems as if JS is actually getting more hate than PHP, which is certainly odd, considering the stereotype.

So, as someone who has spent a lot of time in JS and a lot of time elsewhere, here are my views. Please, discuss your opinions with me as well. I am genuinely interested in an intelligent conversation about this topic.

So here's my background: learned HTML/CSS/JS in that order when I was 12 because I liked computers. I was pretty shitty at JS until U was at least 15, but you get the point, Ive had it sploshing about in my brain for a while.

Now, JS certainly has its quirks, no doubt, but theres nothing about the language itself that I would say makes it shitty. Its a very easy leanguage to use, but isn't overdeveloped like VB.net (Or, as I like to call it, TheresAFunctionForThat)

Most of the hate is centered around JS being used for a very broad range of systems. I doubt JS would be in the rant feed so often if it were to stay in its native ecosystem of web browsers. JS can be used in server backend, web frontent, desktop and mobile applications, and even in some system services (Although this isn't very popular as of yet). People seem to be terrified that one very easy to learn language can go so far. And, oh god, its interpreted... How can a system app run off an interpreted language? That's absurd.

My opinion on JSEverything is that it's progress. Thats what we're all about, right? The technologies already in place are unthreatened by JS, it isn't a gamechanger. The only thing JS integration is doing is making tedius and simple tasks easier. Big companies with large systems aren't going to jump ship and migrate to JS. A startup, however, could save a fucking ton of development time by using a JS framework, however. I want to live in a world where startups can become the next Google, because technology will stagnate when youre trying to protect your fortune, (Look at Apple for fucks sake) but innovation is born of small people with big ideas.

I have a feeling the hate for JS is coming from fear of abandoning what you're already doing. You don't have to do that. JS is only another option (And a very good one, which is why it's becoming so popular).

As for my personal opinion from my experiences... I've left this part til the end on purpose. I love programming and learning and creating, so I've never hated a lamguage, really. It all depends on what I want to do. In the times i've played arpund with JS, I've loved it. Very very easy. The idea of having it on both ends of web development makes a lot of sense too, no conversion, just direct communication. I would imagine this really helps with speed, as well. I wouldn't use it in a complicated system, though. Small things, medium size projects: perfect. Running a bank? No.

So what do you think about this JSUniverse?

Comments
  • 16
    I'm loving it. Been working with JS at my full time job for 4 years now (node js that is).

    That being said, I think I've learned more about JS by using other languages. Been learning some Elixir, Go, and Haskell on the side and I've been living the new patterns I learn. I'm sometimes sad about not having Elixir's pattern matching, or piping, or Go's gofmt, but I get by and build cool dynamic things that otherwise wouldn't be possible with other languages.

    JavaScript certainly feels like a kid's toy after using C# or Java for a long time, but once you actually take the time to learn the language with all of its quirks, you learn a lot of cool and useful patterns. Learning JS has helped me ask the right questions when learning other new languages, like how it handles asynchronosity, and functional programming patterns.
  • 1
    There's a lot in your post so I'll try not to go on too much.

    JavaScript was never intended to be used for what it is being used for nowadays. And that's fine. The ECMA standard is being evolved and extended to try to address those gaps. But some would argue they're making it more blurred instead of clearer.

    "Truthiness" drives purists insane - it's an insane concept. You get used to it, but some people always struggle with it.

    As @Letmecode says, it really does encourage hipsters. Projects can be from massive orgs (Google, Facebook) or a bunch of teenage mates, and you're generally none the wiser either way. And things get rolled into production platforms that are not ready nor appropriate.

    And it does allow you to write purely bonkers, nonsensical code and let anyone on the web read and maintain it.

    Also, it's shiny. It's *the* thing these days. Developers are magpies... they're blinded by shiny and flock to it.
  • 1
    @jAsE What about the syntax don't you like? I find it to be much like a weak-typed version of Java or C with a much more forgiving nature.
  • 0
    @Letmecode @CrankyOldDev I totally agree about the hipster issue, but thats partly why it's also so good, that just a couple of people can create something. Usually it's shit, but the opportunity is there and thats what matters.
  • 2
    JavaScript is not the problem. It's the fucking ununified core. Every month comes a new framework around which becomes the defacto standard and a few months/years later shit is deprecated. I mean seriously.

    Now don't lie to me, when have you written your last Ajax call without a library?
  • 0
    @Data-Bound Does fetch count? If so, yesterday.
  • 1
    @Tribex if that includes the usage of the xhr object in a direct way; yes
  • 0
    @Data-Bound Truth be told, i never have. I've looked at the how, but I've never actually ussd it
  • 0
    So where is my personal hate to javascript?

    Well, if you start with JS, fine you may actually love it etc. But imagine you start with c++ or anywhere where asynchronous shit is called only when you have perfect awarness of it.

    so consider this example (its pseudocode, i dont have syntax highlighting here and js is too annoying to me to learn it properly, i just dont use it):
    let ok = [];
    sth.foreach ((item)=>{
    if (isOk(item))
    ok.append(item);
    });
    console.log(ok);

    if sth is [1,2,3,4] and isOk was simple (bool)input%2, I expect output:
    [1,3]

    But fucking nooo, I get [ ]. JS will pack in asynchronity in so many places that I will never expect, and that's just tip of iceberg. I have few characters left, so to keep it short, it has many quircks unique to js, and is slow, overbloated and fucking ram usage of same application in say electron and in QT (very fat library) is like 300 mb vs 50 mb, which causes me to say "what the actual living fucking fuck is this fucking shit."
  • 0
    @DubbaThony Come on. I converted your pseudocode to working code and it does exactly what it's supposed to, ie it produces [1, 3].
    const sth = [1, 2, 3, 4];
    const out = [];
    const isOk = num => num % 2;
    sth.forEach(n => {
    if(isOk(n)) out.push(n);
    });

    Also, implying that "JS will pack in asynchronicity in so many places..." is partly right, but it'll do so only when necessary.

    I agree that some things like Electron apps feel bloated, but comparing that to Qt/C++ code where everything is compiled... The same would happen with any interpreted language compared to a compiled one.

    JS certainly can be criticized, but the language itself isn't really that bad. I'd be more inclined to complain about the ecosystem around it.
  • 0
    @BenHub

    Sure, yeah, but if you wrote in any, any language that features foreach, this is obvious foreach ia frking synchronious.

    Much better IMHO is explicit async than implict async.

    I was debugging simmilar code to samplw provided (iterating over cameras in device for browser qr reader) when I was learning JS.

    So yes, there is a ton of forced unnesesary async. If there was keyword async, it woupd be beautyfull feature actually.

    Like that

    async sth.foreach()
  • 0
    @DubbaThony I agree that async does make it harder, and certainly is a pain for newcomers to the language.

    The "unnecessary" async is related, among other things, to performance: JS has a single thread, and you perform a network call, a filesystem read, a DB request, it's blocked until the operation is done.
    There are cases when doing this kind of thing synchronously is OK (e.g. when you're initializing your app), but in the majority of cases you don't wan't to kill your performance by going synchronous.

    Funny thing, you mention the keyword async, it now exists and you put it before a function declaration. In the code that uses that function, you have to put await before the call.

    While it's great it's also a source of confusion, since you can still perfectly write async code that has nothing to do with the async keyword.
  • 0
    @BenHub

    Yeah, async has its advantages, dont get me wrong.

    BUT.
    my issue with JS is that it is IMPLICT not EXPLICIT.

    Why JS creators had this bright idea to make it implict, no frking clue.

    I would rant much less about JS if **calling** function could be explicit async not **creating** it. So internal API is allways synchronous unless you explicit tell it to not be.

    It would do few great things:
    - newcomers, welcome, suddenly much less hostile language.
    - callback hell much lesser of an issue, especially for newcomers
    - better controll of what the frick is going on behind the scenes.

    Also IMHO there should be (or maybe there is but Im unaware of) explicit call to process async queue (do "tick") like you have in let's say QT which is async-focused framework for C++
Add Comment