My impressions of Dart

TL;DR: What do you get when you design a dynamic programming language that is fast, familiar to programmers, and meant to compile down to JavaScript? Dart.

Why does Dart exist?

Dart is an attempt to provide a programming language for the web that's a bit more sane than JavaScript. The fact that JavaScript: The Good Parts exists and is 172 pages long tells you what kind of language JavaScript is at the moment. To me, the fact that there are so many "don't do that" rules to JavaScript and you are always told to use just a subset of the language suggests that JavaScript currently has some rather sharp edges and needs some work.

So Google asked the developers of V8 to create a new programming language for the web. They knew they needed to compile down to JavaScript, so that automatically puts limitations on the language since any semantics that can't reasonably be represented in JavaScript in a performant manner are out the door. Also being compiler writers, they decided to not cause trouble by trying out a bunch of cutting edge language ideas. They went fairly conservative and designed a language that feels like Java if it was done as a dynamic programming language today.

The one thing they did do, though, was make type declarations optional; they aren't even used by Dart's compiler since the team already knew how to optimize a language without types thanks to their V8 experience. The type information you add to a Dart program is there to act as documentation and to facilitate tooling support (e.g. refactoring, auto-complete, etc.). That's probably the one feature it is most known for.

At this point Google is trying to get Dart to become a standard through ECMA. That way it would become more of a selling point to get the Dart VM added to web browsers so you get even better performance than just the optimized JavaScript that dart2js produces.

It should also be mentioned that Dart can be used as a server-side language as well, much like Node.js allows for JavaScript. I didn't use it this way as I'm after a JavaScript alternative; I'm happy with Python or Go on the server.

How did I learn Dart?

First I read the book, Dart: Up and Running. It's a quick read and I was going to be traveling so it worked out nicely.

Second, I created a web app to make it easy to enter a history of trips that leads to GeoJSON output. I used AngularDart for the MVC framework and Bootstrap for the UI. The final result isn't something I would want to promote for the general public to use, but it does the job for me in maintaining a GeoJSON file of the various trips my wife and I have taken. In the end I probably wrote about 600 lines of Dart code between the main logic, UI logic, and tests.

I did all of my coding using the Dart Editor. It's basically an Eclipse RCP app that's dedicated to Dart. It's okay, but I could still tell I was using Eclipse which just isn't my thing (I'm a Sublime Text/Vim user typically). There is a Dart plug-in for WebStorm if you prefer IntelliJ IDEs over Eclipse. But since the Dart Editor is so heavily promoted and all documentation assumes its usage I decided to stick with it the whole way through.

What is my opinion?

Dart is totally fine. I know that's a somewhat bland answer with a positive twist, but there it is. I didn't end up coming away disliking the language, but wasn't energized by it either. If I was told at work I had to use Dart I wouldn't throw a fit like I do for some other programming languages, but it wouldn't be my first choice either. That's my opinion of the language as a back-end language anyway.

As a front-end/browser language? It's definitely has less sharp edges than JavaScript; basically unless you prefer prototypal inheritance over class-based inheritance I don't see any reason to not use Dart for new projects (it has closures and such so you don't entirely use the functional aspects of web programming, plus it can call JavaScript in an asynchronous manner for backwards-compatibility).

That being said, one could still look at CoffeeScript, TypeScript, ClojureScript, the in-development version of ECMAScript (which you can try through Traceur), or various other languages that transpile to JavaScript as alternatives to Dart. Personally I'm curious to see what ClojureScript and CoffeeScript are like before I call a winner for my personal use as a web browser programming language.