Modern Software Experience

2011-10-10

Dart Logo

JavaScript-killer?

JavaScript

JavaScript is the one-but worst programming language name choice ever. The possible confusion of JavaScript with the Java programming is deliberate; a bunch of NetScape and Sun marketroids thought renaming LiveScript to JavaScript would somehow make LiveScript as hot, popular and exciting as Java.
The very worst programming language name choice ever is ECMAScript, the official name of the language often known as JavaScript. That name choice does not just admit to a designed-by committee lack of creativity, it so uninspiringly bad that everyone prefers the awful JavaScript name over its official one. One fine future day, ECMA will officially apologise for lending its name to this NetScape abomination, but what we really want is an apology for the name. It's hideous.

JavaScript isn't a web standard

JavaScript is the de facto standard for web scripting, but, contrary to popular JavaScript programmer opinion, JavaScript is not a web standard. JavaScript is widely supported, by all major browser vendors on all major platforms, but that does not make it a web standard. JavaScript is a scripting language for the web, and the ECMA-262 ECMAScript Language Specification is the standard for that scripting language, but that combination of facts still does not make it a web standard.
Web standards, officially known as recommendations, are set by the World Wide Web Consortium (W3C). Nothing is a web standard until the World Wide Web Consortium says it is. Web standard do not have to originate with the W3C. The W3C endorsed PNG as the bitmap image standard for the web. The W3C has not endorsed any web scripting language.

JavaScript isn't an official web standard, but it is the de facto standard for web scripting.

performance

JavaScript isn't an official web standard, but it is the de facto standard for web scripting. In recent years, the major browser vendors worked hard to JavaScript more attractive by focussing on improving the performance of their JavaScript engine. Google was at the forefront of this race to improve JavaScript performance, yet despite all the effort they put into making JavaScript more attractive, it is Google who wants to kill JavaScript and replace it with something new: Google Dart.

Google Dart

Dart is a web programming language created by Google. Dart isn't Google's first programming language. Late in 2009, Google announced Go. Go is a general purpose language. Dart is a language designed for the web. Google's aim isn't modest; Google wants Dart to replace JavaScript. That does not mean that Google is going to stop working on JavaScript.

Dash

When the world first heard about Dart, on 2011 Oct 10, it was still called Dash. A leaked internal Google memo about the future of JavaScript dated 2010 Nov 16 contains the following Executive Summary:

Javascript has fundamental flaws that cannot be fixed merely by evolving the language. We'll adopt a two-pronged strategy for the future of Javascript:

  • Harmony (low risk/low reward): continue working in conjunction with TC39 (the EcmaScript standards body) to evolve Javascript
  • Dash (high risk/high reward): Develop a new language (called Dash) that aims to maintain the dynamic nature of Javascript but have a better performance profile and be amenable to tooling for large projects. Push for Dash to become an open standard and be adopted by other browsers. Developers using Dash tooling will be able to use a cross-compiler to target Javascript for browsers that do not support Dash natively.

JavaScript support

It is only natural that Google continues to support JavaScript. There are many sites using JavaScript, so Google really cannot simply drop JavaScript support from Chrome. Moreover, Google still wants users to pick Chrome over other web browsers, so Google does not merely want Chrome to continue to support JavaScript sites, they'd also like Chrome to be the best browser to visit JavaScript sites with.
So Google has good reason to continue to support JavaScript, and to continue to improve its JavaScript engine however it can. Besides, Dart is new, and its success isn't garantueed. No wonder then that Google wants to continue to be involved in JavaScript's evolution.

The rationale for the new language is that JavaScript has fundamental flaws, historical baggage that cannot be solved without a clean break.

JavaScript problems, Dart goals

The memo goes on to discuss why Google should pursue the two-pronged approach. The rationale for the new language is that JavaScript has fundamental flaws, historical baggage that cannot be solved without a clean break. The idea is to make the web incrementally better today by continuing to support and improve JavaScript, and making it substantially better in the future with Dart.

The memo set several design goals for Dart that reflect what Google thinks is wrong with Java. These goals are performance, developer usability (easy to get started), toolability, and, oh, security.
Today's Google Code and Chromium Blog blog post list slightly different design goals:

  • Create a structured yet flexible language for web programming.
  • Make Dart feel familiar and natural to programmers and thus easy to learn.
  • Ensure that Dart delivers high performance on all modern web browsers and environments ranging from small handheld devices to server-side execution.

wait and see

It is only natural to have a wait and see attitude towards an announcement like this. It is a fairly early announcement; Google is merely introducing the Dart language, not much more. There is a Dart VM, but it is not integrated into Google Chrome yet. The dedicated Dart website offers preliminary tools for developers eager to learn about Dart and get started with it.

Developers are a skeptical bunch, and Google needs to convince that them that it worth spending their on this new-fangled language. The obvious way for Google to gain the necessary credibility is to eat their own dog food and rewrite their JavaScript-heavy Google Apps in Dart. Once they've done that, interest in Dart is sure to increase.

browser support

A key obstacle to the acceptance of Dart is browser support. Google will surely add their Dart VM to Google Chrome, and has plenty of resources to develop plug-ins for Firefox, Safari and Internet Explorer, but that is not good enough. Plenty of organisations allow their employees to use nothing but one browser and a predetermined set of plug-ins. The JavaScript VM isn't some plug-in that needs approval, but comes with the browser itself. Dart cannot hope displace JavaScript until the Dart VM comes with the browser too. Google needs other browser to integrate a Dart VM directly into their product, and convincing other browser vendors to do so may not be easy.

Limited browser support for Dart makes it impossible for developers to switch to Dart. Limited demand for Dart support will not enthuse browser vendors to dedicate resources to it. And oh, until most web browsers support Dart, one way or another, Google cannot redo their Google Apps in Dart.
The solution to this chicken and egg problem is a compiler that translates Dart into JavaScript; it allows programmers to code in Dart and deploy the resulting JavaScript code to take advantage of the existing JavaScript support until Dart itself is sufficiently supported.

That approach may sound familiar. It is the approach Google took with the Google Web Toolkit (GWT). The Google Web Toolkit lets developers program in Java, and use the Java-to-JavaScript compiler to deploy the resulting JavaScript. The Google Web Toolkit was released in 2006; Google has been not-liking JavaScript for some time now. The Google Apps are not really build in JavaScript, but in Java, using the Google Web Toolkit. The observation that Google needs to eat its own dogfood to convince developers stands.

learning more

According to Google's blog post, the Dart site has preliminary tools, but these seem to be delayed. The Dart source code is available on Google Code. The Dart site itself offers a technical overview, tutorials, sample code, several articles, the language specification (draft version 0.01) and the Dart library reference.

links