paint-brush
JavaScript — A First-Class Language At Lastby@tomgoldenberg
20,203 reads
20,203 reads

JavaScript — A First-Class Language At Last

by Tom GoldenbergMay 4th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In 2003, <strong>Paul Graham</strong> wrote about his company’s decision to use <strong>Lisp</strong> (a <a href="https://hackernoon.com/tagged/programming" target="_blank">programming</a> language). <a href="http://www.paulgraham.com/avg.html" target="_blank">His essay</a> portrays Lisp somewhat as the French of computer languages —unique, esoteric, and able to give expression to the inexpressible (<em>je ne sais quoi</em>). It was Lisp, he argues, that gave his company an unfair advantage over its competitors.

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - JavaScript — A First-Class Language At Last
Tom Goldenberg HackerNoon profile picture

In 2003, Paul Graham wrote about his company’s decision to use Lisp (a programming language). His essay portrays Lisp somewhat as the French of computer languages —unique, esoteric, and able to give expression to the inexpressible (je ne sais quoi). It was Lisp, he argues, that gave his company an unfair advantage over its competitors.

If Lisp is like French, then JavaScript today is like English. Though both may be an inconsistent hodge-podge of syntax, English is the most widely spoken language in the world, and JavaScript the most widely used computing language.

Yet JavaScript still doesn’t command the same respect that other languages do. While it continues to grow in use among startups and larger companies, it is often considered useful only out of necessity. Senior engineers at large companies claim that it isn’t a “real” programming language. Many aren’t aware that it is used for purposes other than pixel manipulation.

As a JavaScript engineer, I wanted to dig deeper into the public perception of the language and how rooted in reality it is. What I found is that some criticisms hold water, but many do not.

A Growing Ecosystem

JavaScript is increasingly being used in aspects of software development other than stylistic effects— for example, backend tasks, web servers, and data processing. As Guillermo Rauch, CEO of Zeit, points out, JavaScript “is the result of evolution, not design. [It] was made quickly and with a small purpose in mind. The rest is market forces and adaptation.”

Rauch’s company offers an open source web framework that only uses JavaScript, on the browser and the server. It turns out that many companies are doing the same. The site StackShare.io, which displays information about companies’ tech stacks, shows that more companies on the site use JavaScript on the back-end (6,000) than Python (4,100) or Java (3,900). This site is heavily geared towards startups but it is a data point that indicates a growing ecosystem. Below is a Venn diagram showing the tech stacks of different companies and their respective market share (data from StackShare.io).

Cross-section of programming languages used for back-end services in tech companies (market share values approx.)

What about programming jobs? A look on Indeed.com shows us that the majority of US programming jobs are in Java, but JavaScript is not far behind, as illustrated below.

Other statistics that weigh positively towards JavaScript:

  • It has the most open source projects on Github (by more than 50% over Java).
  • NodeJS was voted as the most popular framework in Stack Overflow’s developer survey for 2017.
  • JavaScript is currently the most popular programming language on Stack Overflow.

Criticisms of JavaScript

I asked a friend from Oracle what concerns engineers had about JavaScript. What he said was that “because it is an interpreted, untyped language, it would not be ideal for systems programming.” This is a common complaint against the language. A JavaScript function will accept anything as an argument, where a Java one will throw an error if the argument is not a specific type¹.

function doSomething(literallyAnything) { return; }

I asked another friend who works at Google. He pointed me to some open issues on NodeJS, saying that some of the mistakes, though trivial, gave him cause for concern as to the framework’s maturity.

Rauch points out that JavaScript’s garbage collection isn’t the most optimal. Another criticism is that Java and Python are more well-suited for data-science projects, like machine learning and natural language processing. This may have more to do with the available libraries for these languages rather than an inherent deficiency. Academia’s reliance on Java and Python plays a part as well.

Several engineers that I spoke to mentioned that they often heard other engineers speak down on JavaScript as a programming language. While there are real concerns about JavaScript being used for back-end tasks, much of the antagonism seems out of touch with the current state of the language and ecosystem.

Current State of the Art — JavaScript

JavaScript has come a long way in the past 5 years. Some of the early use-cases for JavaScript were features like Facebook’s “like” button. When a user clicks the “like” icon, the page doesn’t refresh but changes its status. This type of behavior is only possible on the web through JavaScript.

Developers started using JavaScript several years ago to make single-page applications (SPAs). The term “single-page” refers to the fact that these applications load code to the browser only once, and all subsequent views are generated with JavaScript. A criticism against these was that they took a long time for the initial download — up to 20–30 seconds on mobile!

In the last 2 years, the technology for sending JavaScript code to the browser has improved dramatically (see: webpack). This has eliminated the slow-loading speeds of JavaScript web apps, creating better performance and user interaction. This is the current state-of-the-art in web development.

With these advances came new paradigms for using JavaScript. State management libraries applied computer science principles to user interactions. The bar for JavaScript engineers became higher.

Viewed in the context of these changes, it makes sense for early-stage companies to use JavaScript on the back-end as well. If you already have talented front-end JS engineers, this enables them to collaborate, review, and share code more easily.

Although JavaScript may have started as the language of the browser, it is becoming more ubiquitous in all aspects of computer science — the web, mobile, IoT, and back-end services. Engineers would be wise to not dismiss it based on their outdated perceptions of the language. While it has always been a “real” programming language, we are finally reaching the time when such claims stand out for their misunderstanding more than anything else.

Conclusion

From these observations, it is clear that JavaScript has met the following criteria of being a first-class programming language:

  • Broad adoption by startups and large private companies as a framework for back-end services (NodeJS)
  • A thriving open source community (most active on Github)
  • A strong demand for knowledge of it as a professional skill (Indeed.com)

In the end, a company’s decision to pursue a certain tech stack is all about compromises. We use JavaScript for front-end and back-end services at Commandiv, but it is not for everyone. Part of the decision was familiarity. In order to move fast at a startup, being handy with the tools you use is essential.

That said, I think that the days of questioning whether JavaScript is a “real” programming language are gone. Its journey is far from over, but its rate of adoption and improvement gives plenty of confidence for its path forwards.

Thanks to Alim S. Gafar for reviewing.

Tom Goldenberg is CTO and Co-Founder of Commandiv, a personal investing platform. If you enjoyed the article, please like and share it!

Footnotes

¹ While the language doesn’t support static types, companies like Facebook and Microsoft have released libraries that add this functionality (Facebook released Flow, and Microsoft released TypeScript).