Twitter GitHub Facebook Instagram dirv.me

Daniel Irvine on building software

JavaScript needs our love

15 July 2014

Ah yes--JavaScript. The programming language we love to hate. It’s the new Visual Basic. Right? Well, take a look at this:

These graphs show results from a 2012 Hacker News poll. The poll asked readers to vote on the languages that they liked most and the languages that they liked least. The results show that JavaScript is not only popular but has a large number of faithful supporters.

  • There are roughly 3 times as many people that consider JavaScript their favorite language than those who dislike it.
  • That ratio of 3:1 is higher than the ratio for C++, PHP, Java and--not surprisingly--Visual Basic. So JavaScript is most definitely not the new Visual Basic, which is almost universally disliked.

Nevertheless, there is a lot of hatred on the for this language. But how much can we trust anecdotal evidence? Let’s take a look at some popularity statistics instead.

CodeEval shows that JavaScript usage is its 5th most popular language. And--uh oh--JavaScript use is 33% up on last year... OMG.

JavaScript is the most popular language on both GitHub and StackOverflow.  Sorry, what? It topped the popularity rankings? For not just one but two of the largest developer communities? Well sure, that kinda makes sense: It’s on StackOverflow because many people have to write the odd script here and there. JavaScript is that language that we grudgingly write to get our web front-end working, but we don’t actually want to learn anything about the web browser--so we just post to StackOverflow and rely on the kindness of others. It’s likely number one on GitHub because modern JavaScript developments means using an array of libraries such as jQuery. These libraries must be checked in alongside your source, and in source form. Other languages with “real” library support don’t suffer this issue, so the GitHub statistics may be skewed by this fact.

Moving on, what about the venerable Tiobe index, the monthly update on language search popularity? Well, it would appear JavaScript has bumped along in 9th and 10th place for the past few years, according to InfoWorld. Why so low compared to the popularity on StackOverflow and GitHub? The linked article contains a great quote from Tiobe’s Managing Director, Paul Jansen:

“JavaScript is actually never or hardly ever used as a standalone language. It is always the helper language of a system that is programmed in something else.”

-- Paul Jansen, Tiobe Managing Director

There’s a whole lot of truth in this, and perhaps this is the root of the issue. We loathe JavaScript because for many of us JavaScript development will never be our main focus. We spend as little time as possible putting our JavaScript code together--just enough to get the job done, and once it’s done we run back to the comfort of our Ruby, our C#, our Java.

This ties in our reasoning on the GitHub and StackOverflow statistics. So with a little bit of context, we can see that the statistics do agree even if they appear to be wildly different on first glance.

JavaScript is not actually a bad language, argues Douglas Crockford, who gained notoriety by taming the beast. It’s certainly capable, even if the language has terrible warts. So perhaps it’s not so much hate that we feel for JavaScript, but dread--we don’t want to invest energy in learning a language that we know we won’t be making much use of.

We all know the real answer to this. Put your ego aside. Stop being lazy. Summon the energy. Yes, in the long term you’ll reap the rewards by learning JavaScript, even if the short term gains are small.

Perhaps it’s time to show some love?

About the author

Daniel Irvine is a software craftsman at 8th Light, based in London. These days he prefers to code in Clojure and Ruby, despite having been a C++ and C# developer for the majority of his career.

For a longer bio please see danielirvine.com. To contact Daniel, send a tweet to @d_ir or use the comments section below.

Twitter GitHub Facebook Instagram dirv.me