The JavaScript Alternatives

Three languages compete to make JavaScript easier to write and faster to execute. Which to choose?

Andrew Binstock, Editor-in-chief, Dr. Dobb's Journal

March 14, 2014

2 Min Read

Two and a half years ago, in discussing JavaScript's ubiquity, I projected that this trait alone would make the language the continued target of new languages and compilers. And in fact, this has happened. Many languages now offer the ability to compile to JavaScript in addition to their original principal targets.

For example, among those that also compile to native code, there are Nimrod, which we discussed last month; Fantom; and the gaming language Haxe. In addition to these, there are many standalone tools that translate code from your favorite language to JavaScript. Of these, the most famous by far is the underappreciated Google Web Toolkit (GWT), which converts Java code to JavaScript. (I say underappreciated because the tool definitely has magical aspects to it. For example, you can live debug Java code, which is mapped behind the scenes to the actually executing JavaScript.)

There is another segment of the industry, though, where a lot of action is taking place. Entrants here aim to correct the perceived shortcomings of JavaScript by either extending or improving the language and offering code-to-JavaScript compilation. The most widely known players are CoffeeScript, Google's Dart, and Microsoft's TypeScript. Their approaches are rather different, but all aim at enabling JavaScript to be used in larger projects than it was ever intended for.

The first of these languages to come to market (in 2010), CoffeeScript is probably also the most established. It borrows concepts from both Ruby and Python to reduce clutter and remove some ragged aspects of JavaScript syntax. To be comfortable with CoffeeScript, you must be willing to forgo traditional mainstream programming constructs — curly braces, semicolons, etc. — and adopt new syntactical elements like meaningful white space. Users of Python and Ruby already have partially adopted those conventions, and so it's no wonder they in particular have embraced CoffeeScript. For example, it's now part of Ruby on Rails (as of v. 3.1). And at GitHub, it's the recommended language for doing Web development.

Read the rest of this article on Dr. Dobb's.

Read more about:

20142014

About the Author(s)

Andrew Binstock

Editor-in-chief, Dr. Dobb's Journal

Prior to joining Dr. Dobb's Journal, Andrew Binstock worked as a technology analyst, as well as a columnist for SD Times, a reviewer for InfoWorld, and the editor of UNIX Review. Before that, he was a senior manager at Price Waterhouse. He began his career in software development.

Never Miss a Beat: Get a snapshot of the issues affecting the IT industry straight to your inbox.

You May Also Like


More Insights