Why Google Dart Will Miss Its Target

Craig Buckler

Dart is Google’s new programming language designed for creating structured web applications. You’ll be able to run it on the server but it’ll also run on the client. In a browser.

Depending on what you read, Google has both admitted and denied that Dart is a replacement for JavaScript. However, Chrome will shortly be able to use either language and, given the choice, I’m sure Google would prefer developers used a solution they control.

I was initially skeptical about Dart but reserved judgment until more information was available. I can now categorically state that it’s almost certain to fail in the same way VBScript did in Internet Explorer.

Dart’s Goals

Dart is an open source project with the following design goals:

1. Create a structured yet flexible programming language for the web.
Great. But what’s wrong with all the other structured and flexible languages? One of the web’s greatest benefits is you can use any server-side language you like: PHP, C#, VB, Perl, Java, Ruby, Python, etc.

There’s always room for improvement but we’re spoiled for choice. Dart doesn’t offer something different — just an alternative.

2. Make Dart feel familiar and natural to programmers and thus easy to learn
Syntactically, Dart is very similar to Java, C++ and C#. So why didn’t Google simply adopt one of those languages? That would have made it even easier to learn.

3. Make Dart appropriate for the full range of devices.
Google has stated that they’re “up against fragmented mobile platforms”. Wouldn’t another language fragment it further?

It’s possible Google will create a native Dart runtime for Android. Perhaps they’ll even create a version for Windows phones. What about Apple — the most successful smartphone vendor? Not a chance.

4. Provide tools that make Dart run fast across all major modern browsers.
Will Microsoft, Mozilla, Apple or Opera add native Dart clients to their browsers? It’s unlikely.

Google could create plugins for those platforms but web developers won’t write Dart code until the plugin has a wide installation base. Unfortunately, users won’t install the plugin until compelling applications have been developed using Dart. Catch-22.

JavaScript Compilation

Google doesn’t actually need to a Dart plugin since they’ve created a compiler which translates Dart code to native JavaScript.

Before you get too excited, take a look at a compiled Dart “Hello World” program. Nine lines of Dart code is successfully compiled to … 17,259 lines of JavaScript.

I’m sure that situation will improve. Even today, it could be run through Google’s Closure Compiler to make the code more efficient. But the fact remains that native JavaScript written by a half-decent JavaScript developer will always beat compiled Dart code.

Even if you do develop in Dart, you’ll probably want to drop into JavaScript at certain points to improve efficiency. But if you can already write good quality JavaScript, why would you develop in Dart? Catch-22-2.

Show JavaScript Some Love

It’s clear from Google’s documentation that Dart is aimed at developers who dislike JavaScript.

Despite being the world’s most-used programming language, JavaScript is the most misunderstood. The name doesn’t help — it’s neither Java or script — but the biggest cause of bad press comes from professional programmers.

Initially, JavaScript looks a little like C++ or Java. Developers with knowledge of those languages hunt through the manuals for the class syntax only to find it doesn’t exist. They conclude JavaScript is awful or attempt to force classical inheritance techniques into their code.

I implore you to persevere. JavaScript is flexible and allows you to write code in a number of ways. Once you understand concepts such as prototypal inheritance, JavaScript will earn your respect. It may not be perfect but class-based languages soon begin to feel clunky.

Don’t expect it to happen overnight. It took more than a decade for developers to rediscover the beauty of JavaScript. Fortunately, there are many fabulous resources on the web and JavaScript is recognized as a first-class language.

Because You Can’t Fight it

The major problem for Dart is that JavaScript is everywhere; from humble mobile phones, to Apple iPads, to modern desktop browsers. Microsoft is even making HTML5 and JavaScript key technologies for application development in Windows 8.

Even if Chrome reached 50% market share, would you develop in a language which was supported everywhere or on just half of all devices? Perhaps it would have stood a chance if it was released a decade ago, JavaScript was utterly terrible or Dart was revolutionary. None are true.

I’m glad Google continues to innovate but Dart feels like a backward step. You may dislike JavaScript, detest HTML and despise CSS — but, to be a web developer, you can’t avoid them.