/ Technical

The Final Language

Why are there so many programming languages?

I've had the privilege of working with a few people getting started in the world of programming, and that's one thing they consistently ask. It's a reasonable question, and it's surprisingly hard to answer. It's a open secret in our industry that most languages are basically the same. If you've learned one or two, picking up a new one is pretty trivial.

The short answer, I think, is that it's the same reason there are so many human languages. It's because they evolve independently in different regions. They tend to proliferate something like

Lets imagine a language called (Purely hypothetical, no resemblance to a real-world language) "Lava". It's developed by company A, who intend it as a language to program on their new platform. Now, Lava includes a couple of cool new ideas, which make it very pleasant to program in. It really takes off, and by taking off, it inspires imitators. A couple years later, Company B will come out with their own near-identical-but-not-quite-compatible language for their platform, called "L#". L# imitates the features that made Lava unique, while trying to fix some of the quirks which even the designers of Lava admit "Seemed like a good idea at the time". Meanwhile, several other languages release versions which pull in those innovations from Lava. Flash forward a decade, and Lava's innovations are no longer unique, and those quirks are starting to make it look a little crusty. But at this point several large companies are dependent on it, and it has a very useful Web Framework and ORM which a lot of the internet depends on. Various open source projects keep creating new languages which are bytecode-compatible with Lava, but try to improve the syntax. Many of them see limited adoption by a few companies, but none of them really rise up to replace Lava.

In other words, new languages are popping up all the time. It's not terribly hard to create them (Creating a simple one is a common student project, and even complex ones can be the work of a single creative mind). It seems like most of them that survive do so because they become entrenched in some sort of niche. Either

  1. They are the only good way to access a particular platform (Swift, C#, Java, Javascript, C)
  2. They have some sort of library or framework which is so useful that people will learn the language just to get at it (Ruby/Rails, Python/Data Science Tools, PHP/Wordpress)
  3. They allow a swath of people to start programming who wouldn't be able to otherwise (PHP, Visual Basic, Python)

I think that answers the immediate question of why there are so many languages, but I see another question buried deeper in there:

Is it really necessary to have so many programming languages?

Look, I love programming languages. It hurts my heart to say this. But I think the answer is "NO". Python and Ruby are both beautiful languages, but they both do basically the same thing. Ditto for Java, C#, Swift, and Kotlin. The world would probably be a better place if all their respective platforms shared a common language.

Again, I think there is an analogy to human languages. The world would be a better place if we could all speak a common language. The reason we don't isn't because every language is necessary, it's more because of historical reasons. Every nation has a legacy and a history in their language, and it's simply not feasible to get everyone to drop everything and learn a new one. I think that applies just as much for programming languages. They are deeply entrenched parts of their respective platforms, and they will continue to be separate as long as the platforms are separate

But, I think we are seeing a fascinating trend of software converging onto one platform. I expect the trend to continue. That platform will eventually replace the majority of software written for .net, Java, iOS, and Android, and it's language will be become the universal programming language

That platform is the Web Browser, and its language is Javascript.

This has already mostly happened on Desktop computers. Do you remember how, back in the old days, software was something you installed from a CD? And the CD that worked on Windows wouldn't work on Linux? For most of our computing, that era is behind us. Most of our software runs inside our web browsers, and it's only a small (and dwindling) group of programs which run from our desktops. And if it's inside that Web Browser platform, Linux and Mac and Windows are all able to run the same software. There's no separate "OSX version" of a web page; they can run the exact same code. I think it's only a matter of time before the same paradigm overtakes iOS and Android.

I've got a bold forecast to make

In the next 20 years, Javascript will become the default language for writing software.

That's right, homely ol' Javascript. That humble language, which Brendan Eich cranked out in just 10 days back in 1995, intended to be the dopey kid brother to Java. That language with it's quirky type coercion, its variable hoisting, and its error-prone "this" keyword. Over the years it has grown.

  • The recent ES6/ES2015 upgrades have taken those parts of Javascript which have always been really nice (Javascript objects, closures, and dynamic typing), and supplemented them with all the features you could desire in a modern languages. It's now got a good module import/export system, arrow functions (which also solve most of the problems with the "this" binding), a Java-like class syntax, and chainable functional mainstays attached to the array prototype (map, filter, reduce, etc.). The ES2017 update even adopts C#'s excellent async/await syntax for managing concurrency.
  • It is FAST: Dynamically-typed languages like Javascript typically suffer from slow execution speed (The standard is about 2-5% of the speed of Java), but Microsoft and Google have invested so much energy in Just-in-Time compiling it for their respective browsers, that it's now up to around 25%-50% of the execution speed of Java. Furthermore, it's event-driven, non-blocking model gives all the concurrency necessary for the great majority of projects, while being much more usable than multi-threading
  • It seems like with the current crop of component-based frameworks (React, Angular, and Vue), the world of frontend frameworks is starting to mature. This will only make creating user interfaces through Javascript that much easier.
  • In the early days of mobile, Javascript-based cross-platform mobile apps got kind of a bad rap. They've come a long way since then. In particular, React Native seems to offer the ability to write
    1. a Javascript-based mobile app
    2. Which runs very nicely compared to native mobile apps
    3. which requires the bare minimum of adaption to be cross-platform compatible

Node

Thanks to the availability of Node, I expect Javascript will take over server-side programming as well. In the typical web stack, there are 5 languages you need: HTML, CSS, Javascript, SQL, and.... SOMETHING on the backend. That something can by Python, Ruby, C#, Java, PHP, or dozens of others. Whichever option you choose, you limit your future hiring to a slice of web developers with experience in that language. But with Node, your stack becomes HTML, CSS, Javascript, SQL, and.... more Javascript! Every web developer who knows Javascript becomes a potential hire, which is just about all of them. That is a killer advantage even before you consider the technical strengths of server-side Node, including:

  • Easy server-side rendering of React, Vue, or Angular apps
  • Less need to duplicate server and client side validation logic
  • JSON as a universal data format
  • Did I mention it's blazing fast? Node's concurrency model seems particularly suited for handling web requests, where it goes so far as to beat multithreaded Java in benchmarks

Nonetheless, it still seems like Node is missing some of the tools it will need to to really conquer the server side. My bet is that that it won't happen until somebody comes out with a big, full-featured web framework with ORM integration, something along the lines of Rails or Django or ASP.net MVC. Among the current crop, it looks like Sails has some potential to grow into those shoes. But I suspect what might happen is, sometime in the next decade, Microsoft will create a version of MVC/Entity Framework which runs on Node. I would not be surprised if such a thing is already in the works at Redmond.

It's not exactly that Javascript will replace all other languages. Games and other GPU-intensive computing will still be done in C++. Large, computationally-intensive backends will still be done in Java or C# or Go. Native software will still be written when it legitimately needs every nanosecond of efficiency it can muster, or it's doing elaborate interactions with the hardware. New languages will still be created, and some of them will find niches or domains where they catch on. But what will happen, is that most new projects will be written in Javascript unless there is a strong reason for them to be written in a different language. This will add up to slightly over 50% of all new code.