JS-diss League of America, by JPRart at DeviantArt

The Super Surrogates of JavaScript

Richard Kenneth Eng
JavaScript Non Grata
4 min readMar 2, 2016

--

There are at least two important things we know for certain about the popular programming language JavaScript:

  1. JavaScript is the native language in web browsers. Thus, we cannot escape from using it in web development.
  2. JavaScript has a great many “warts” and semantical inconsistencies, much more so than in other programming languages. It’s not only slightly worse than other languages; it is substantively much worse. So much so that a book had to be written to guide you through the “Good Parts.”

That being said, there is absolutely no solid rationale to directly program in JavaScript. The language can be used as a transpiler target for other languages that have a more solid foundation. In fact, there is an embarrassment of riches to choose from.

Here are several examples of transpiled languages and their best representative web applications…

Amber (Smalltalk)

Smalltalk is a pure object-oriented programming (OOP) language that has an impossibly clean and simple syntax. In fact, it is widely regarded as the grandfather of OOP languages having influenced numerous other OOP languages, and yet it remains fresh and modern today. With Amber, Smalltalk is ready for the web. (In Amber, JavaScript objects from JS libs are treated just like Smalltalk objects! How cool is that?)

Brython (Python)

ClojureScript (Clojure)

Clojure is a dialect of Lisp (commonly regarded as the grandfather of functional programming, or FP, languages) that runs atop the JVM. It also has a clean and elegant syntax. ClojureScript gives Clojure a strong web presence.

Dart

Dart is Google’s failed attempt to overtake JavaScript, but it remains a good tool for web development.

GopherJS (Go)

Go is a concurrent programming language with a simple syntax and a minimalist, orthogonal and powerful feature set. Despite its controversial nature, it has recently become very popular. GopherJS lets you use this marvelous language for front-end web development. I strongly encourage you to install GopherJS and run the following web app to see how easy it is:

GWT (Java)

Haxe

Haxe is a remarkable language that can transpile to several different platforms, including ActionScript 3, JavaScript, Java, C#, C++, and PHP.

Scala.js (Scala)

These examples demonstrate the efficacy of using a transpiled language for your web development. You need not inflict a broken language on yourself. JavaScript was originally designed as an off-the-cuff scripting language for web browsers. It was never intended for serious software engineering and no matter how much ECMA try to spruce up the language, without fixing its basic, fundamental problems, JavaScript remains unsuitable for writing industrial strength software. Loose typing and freewheeling coercions, silent runtime failures due to bad syntax, and lack of a proper number type are anathema to complex programming. If you want a fun, light language to do relatively simple tasks, JS is fine, but let’s not pretend it can compete with the likes of Go, C#, Java, Python, C++, etc.

Honourable mentions go to Bridge.NET (C#), Cheerp (C++), Cor, Elm, Kotlin, Opal (Ruby), and Transcrypt (Python). They’re worth exploring.

--

--