Programming
Article
By Craig Buckler

Are You Targeting Google Dart?

By Craig Buckler

Dart has reached its version 1.0 target. Google may not care for version numbers but this illustrates to the world that Dart is ready. Whether we are is a different matter.

Dart is (yet another) Google development language for the web. It works server-side as an alternative to PHP, .NET, Ruby, etc. Controversially, it has also been designed as a replacement for client-side JavaScript. Developers can target browsers which implement the Dart VM or pre-process code to native JavaScript.

I was particularly scathing about Dart when it was announced in 2011. My main issues:

  1. Why create another language when plenty of more familiar options are already available?
  2. Why produce a closed platform which is certain to be rejected by the W3C and other browser vendors?
  3. Why does “Hello World” in Dart compile to 17,259 lines of JavaScript code?

Version 1.0 will still generate more than 400Kb but, according to the benchmarks, dart2js code is often faster than native JavaScript. Hmm. I’m not convinced well-written JavaScript code could be outpaced by compiled Dart but the team is addressing the points. If you’re running Dart in its own VM, you can expect performance gains of up to 130%.

The updated dartlang.org site now offers a range of free tools including an Eclipse-based IDE, plug-ins for other editors, the dart2js compiler, the Dartium browser, a full SDK, package manager and API documentation.

What’s not to like?

I’ll tell you: Dart will join the long list of scrapped Google projects. They’ve been patient but, if Dart was to succeed, it would have already done so. Let’s add some more points to the list of criticisms:

Dart is not supported in Chrome
You can’t use Dart in Google’s own browser. Dartium is Chromium with the Dart VM — so there shouldn’t be any technical issues preventing its addition to Chrome and perhaps other Blink-based browsers such as Opera. So why isn’t it there?

No other vendor wants Dart
Dart has been openly denounced by Microsoft, Apple and Mozilla. Google could create VM plug-ins for those browsers but, assuming vendors didn’t actively block it, widespread distribution would be difficult.

dart2js browser support is limited
The JavaScript compiler creates code for the latest versions of Chrome and Firefox, Safari 6+, IE9 and IE10. There’s no guarantee your code will work in IE8, IE11 or mobile browsers.

Difficult client-side debugging
Debugging dart2js applications in a browser requires source maps to trace errors back to the original Dart code. You can do that in Chrome, but you’ll have trouble in most other browsers — especially on mobile.

Developer uncertainty
Perhaps you use Dart. Perhaps you love the language. Does it worry you that Google has abandoned projects which were far more commercially successful?

Google backs JavaScript
The Dart FAQ claims: “Google wants web development to be great, and if that happens with JavaScript, we’re happy.” However, Google is continually improving and promoting their V8 engine used in Chrome and the Node.js runtime. If JavaScript is flawed, they have the power and influence to fix it — why is it necessary to start again?

At best, they’re giving mixed messages. At worst, they don’t believe Dart has a strong future for client-side development.

JavaScript is cooler than ever
Two years is a long time on the web. JavaScript is in a stronger, more dominant position than it was when Dart first appeared.

Why Dart was Devised

OK, I get it. Java and JavaScript are two languages separated by a superficially similar syntax. JavaScript is initially confusing for anyone with a background in C-like programming. You’ll be tempted to use classical inheritance techniques, fail dismally, and find numerous other reasons to berate the language. JavaScript is different; it feels wrong and you’ll want to return to the cozy world of server-side or desktop development. The Dart team has toned down their anti-JavaScript sentiment but that’s exactly why the project was started.

JavaScript is not perfect and there are several issues which make compiler optimization difficult. But it’s not fundamentally flawed. If anything, the language becomes better the more you understand and use it — you may even reach the conclusion that classical inheritance is too rigid and clunky.

I have nothing against innovation and Dart may become a successful server-side development language. Unfortunately, Dart isn’t particularly innovative and, in the browser, it’s a solution looking for a problem.

Do you think Dart can succeed?

More:
Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account