Software // Operating Systems
News
3/14/2014
05:15 PM
50%
50%

The JavaScript Alternatives

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

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.

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 ... View Full Bio

Comment  | 
Print  | 
More Insights
Register for InformationWeek Newsletters
White Papers
Current Issue
InformationWeek Tech Digest, Dec. 9, 2014
Apps will make or break the tablet as a work device, but don't shortchange critical factors related to hardware, security, peripherals, and integration.
Video
Slideshows
Twitter Feed
InformationWeek Radio
Archived InformationWeek Radio
Join us for a roundup of the top stories on InformationWeek.com for the week of December 7, 2014. Be here for the show and for the incredible Friday Afternoon Conversation that runs beside the program!
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.