[Opinion] Why is JavaScript so unpopular?

Hey developers 馃憢

I recently met a 90's developer and we were having a casual conversation about tech. On him asking, what stack do we use in our company, I answered "the JavaScript Stack".

He was shocked and replied: "JavaScript is not scalable and you should consider rewriting the app to Python."

Well, I told him all the popular apps which are built on JavaScript and he was like they all have some or other system which handles traffic separately and it's not JavaScript which is handling the traffic.

I had to quit the conversation as it was a birthday ceremony and I didn't want any fight. :)

Why do you think people think bad about JavaScript?

Henrique Barcelos's photo

I think the main issue is that people don't know JavaScript very well.

JavaScript itself is sort of a Frankenstein. Non-technical people tend to think it is somewhat similar to Java, which couldn't be further from the truth. What Brendan Eich wanted to do back in the time while he was designing the the first version of JS was something like Scheme in the browser. He was "forced" by non-tech stakeholders at Netscape to make it look and feel like Java, because of its popularity back in the day.

So JavaScript has an identity problem. While at the surface it resembles Java, on the one hand because of the name and the other because some constructing blocks and its syntax, it is very (very!) different from it.

For starters, JavaScript is not a traditional OOP language. Despite the last years effort of making it more familiar to OOP developers with the introduction of keywords like class and all that comes with it, under the hood it is still 100% prototype chaining. And that's what almost everyone that writes JavaScript doesn't understand. I've been JavaScript'ing for about 10 years now and I can count in my hands the number of people I've crossed paths with which truly understood the nature of JavaScript prototype model.

I believe the recent wave of Functional JavaScript probably made Brendan Eich happy, because it is much closer to what he envisioned there than the persisting OOP-dominant view we had so far. While not a full-fledged functional programming like Haskell, OCaml, F# and others, FP just seems way more natural to JavaScript constructs than OOP. In fact, most of the clumsy stuff in JS is related to how it treats objects. It took me years to understand this properly and if I'm not paying attention, I can do something wrong with it even nowadays.

Another reason why I love JS (well, most of the time at least) and probably why many people hate it is the degree of freedom it offers. I think the only other language I know that won't get in your way even if you are doing stupid things is PHP. JavaScript lets you free to do whatever you want, but freedom always come with responsibility. It can be burdening having to think about every detail on how to architecture your app, what should be the folder structure, which framework to use. People tend to suffer from analysis paralysis. I myself suffered from this. But then I learnt to embrace this freedom. Every time I start a new project, I get to experiment new patterns, new structures, take some concept borrowed from a language I'm just learning. Sometimes very good things are born from that. Sometimes I fail spectacularly. And that's ok!

People who tell that JS doesn't scale probably forgot to tell that to Paypal, Netflix and many other big companies out there. Here ns Brazil there is big bank whose API layer is (or was about 3 years ago) entirely written in Node.js. Even Microsoft has embraced it.

"Oh, but without type safety, if you change X in Y place, you can break something somewhere in Z". Sure. This also happen in more strict languages, you just discover that earlier. Usually this is a symptom of a much deeper problem: you are not setting the boundaries correctly in your application. There is too much coupling. And if you really really need that compiler telling you you are a moron, that's what TypeScript is for. And guess what, TypeScript is just JavaScript with some sugar on top of it. The programming model is still the same, the constructs are mostly the same, the syntax is very similar as well.

In the end, it all comes around to that old saying:

There are only 2 types of programming languages: the ones people complain about and the ones nobody uses.

Jacob Bogers's photo

Well, JS is extremely popular (>80% coders use JS) because it makes a dev fungible, I think this "negging" is more counterculture thing, JS is very established so its "cool/hipster/rebellious" to kick against establishment.

Marco Alka's photo

JavaScript is not scalable

Thank you for inviting me. Imho, it does not matter if the person is a 90's dev. They clearly missed the past few years of development in the JS ecosystem. It is true that many years ago JS was ugly and not scalable, however it grew. A lot. We have so many new ways to scale JS, so many ideas to workaround JS weaknesses and so many strong new features. It is best to tell people who probably don't know better to first go and research the topic. If they don't, try to keep away, because such people tend to be toxic.

Why do you think people think bad about JavaScript?

JS has a stigma, and especially the devs who don't work a lot with JS might have missed all the cool new stuff.

Todd's photo

I would take that "advice" with a grain of salt. Think about this for a second:

You met a stranger and told him you use JS, and he told you to use Python instead.

Did he know the nature of the app? No.

Did he know the reasons you guys chose JS? No.

Did he know the platforms the app needed to run on? No.

Did he have specific, concrete examples of why Python is more scalable than JS? Doesn't sound like it.

Did he provide examples of a time when he tried to use JS for a specific app and then had to switch to Python due to problems with JS? Doesn't sound like it.

Yet he told you to change technologies... Do you see how silly this looks? Whether or not I'm pro or against JS, just based off of this alone, I wouldn't listen to this person unless they were able to articulate all of those things. These types of people exist in every environment. I don't think "JS has a bad reputation" as much as there are just people out there who find it fun to try and convince others of why they are right and the other person should be doing what they are.

I can think of 10,000 reasons to yell at him about why he should be writing his code in Rust instead of Python... But would I do that without understanding the problem domain, reasonings, history, culture, requirements, and provide specific examples? Absolutely not.

maxdevjs's photo


Vladimir Kostov's photo

People thinking that JS sucks:

  1. Don't know JS's history
  2. Don't know that JS matured a lot
  3. They probably heard it from their role model, and they hate it too
Ben Buchanan (200ok)'s photo

JS has long been a target of tech contempt culture. In the early days it was considered a bit of a toy, beneath the dignity of mighty gods of computer science (you know, people who learned Java at university ;))... and it never really recovered from that stigma, regardless of its evolution. Plus it was popularised during the early days of the web when things were relatively "wild west" - if it worked it shipped, and automated testing wasn't a thing yet - so JS was a bit of a shorthand for traditional programmers wanting to have a bit of a swipe at the web.

JS had two big things in its favour though - 1) it was the only scripting language supported natively in the browser; so people working on the web didn't spend a ton of time hand-wringing about whether their literal only choice was the right one. 2) it has an incredibly low barrier to entry. Much like PHP - you renamed .html to .php and just like that you had a new language to use! So heaps of people get into it because it's so damn easy to start. The quality of the language is only one aspect of its success. A low barrier to entry will make even quirky options like JS and PHP popular!

Some criticisms have evolved a bit eg. dynamic vs static types is a reasonable talking point; even if it's easily solved by using Typescript. But other people still act like we're talking about ES3, rather than ES6. Still others would say "X is terrible, use (my pet language)" no matter what X was.

But there's really no excuse for anyone acting like shipping JS prevents you from following good engineering practices. Also there is a mind-bendingly large list of languages that compile to JS as well, so absolutely nobody is "forced" to use it any more. So a lot of arguments just aren't relevant any more.

Is JS perfect? Oh hell no. Have heaps of businesses done really well with it? Yes. Is JS right for every app? Definitely not. Is Python right for every app? Definitely not. Is JS right for your app? I don't know and neither did the guy at the birthday party. I'm going to assume your team knows what it's doing better than anyone else!

Gergely Polonkai's photo

What he said is generally true. But the same goes for most, if not all, languages.

I was around when JavaScript started to hit the first browsers. I saw it emerge there, then in Node and Electron. I personally find it horrible.

If it weren始t for all the quirks that must be in the language for backwards compatibility (which doesn始t always work, actually), it could be great. On top of this, all engines are hastily written and are awful resource hogs. Most developers argue that it始s reasonable to have a developer machine with 8+ CPU cores and 16+GB of memory, but while i can write the same desktop application in C on a much weaker machine, I disagree. It will even be more portable than Electron apps.

I can probably go on for hours, let this be enough. JS was not written for what it is (ab)used for today. Reimplement it from scratch, and you have a powerful tool. Until then, it始s just an extension to Netscape Navigator.

Tapas Adhikary's photo

I thought it is popular already!

But the 90's developer must be seeing JavaScript since the ugly stone ages of it so, that reaction seems to be acceptable to me.

JavaScript(Ecosystem) vs Python? Highly debatable.

Micah Lindley's photo

I would argue that JavaScript is not unpopular. In fact, it鈥檚 risen in popularity thanks to frameworks like Electron and new technologies such as Progressive Web Apps. Plus you鈥檝e got NodeJS, which is used for servers all around the world. JavaScript is now so versatile that it can be used for web apps, native apps, mobile apps, servers, APIs, machine learning, you name it. Anyone who still thinks JavaScript is unpopular should take a look at the stats- it鈥檚 one of the top used programming languages beside Python.

Blaine Garrett's photo

I didn't feel like I valued Javascript for years until JQuery came around. Even with JQuery, it still felt like a second class citizen simply enabling rich UI interaction on top of server generated markup. There were a few years of darkness during what I call the "early transpiler wars" when co-workers fought to adopt CoffeeScript or Dart or whatever else was the flavor was at the time.

Then Node came along. Personally, it took me a while to come around to Node for backend. Until that point, I was using Node mostly for server side rendering of react. I wrote my first node backend over the past 14 months on Google Cloud and it was generally a great experience. Admittedly, spending years in PHP, Python and Java, the biggest learning curve was to properly account for Promises and not doing non-performant things like array.forEach (vs. traditional for loops) with big datasets. I was skeptical at first of Node's single threaded nature, but I believe most concerns around that are simply misunderstandings of how it works.

I will say that part of my decision to adopt Node was ease of hiring circa Nov 2018. Initially, I planned the architecture to be a React front end supported by Python APIs. We were getting a lot more applicants for the React positions than the Python ones. Cross training was thus a lot easier and I think really helped the team as a whole on a variety of fronts.

To that point, I would disagree that Javascript is unpopular.

Moralist Festus's photo

Good. Javascript has been used for numbers of years when it comes to real functional web development. The fact that you heard Javascript is unpopular doesn't limit what Javascript can do. Javascript is gradually growing and has been used in various tech life. Even most companies now employ Devs with a good Javascript knowledge and some of its frameworks like Vue Js, Angular JS, React, etc. Javascript now serve for various developmental role such as web, native app dev, web games, iOS dev and even native game development. Javascript is Popular and mind you it is one of the most demanding language in larger companies.