Why Dart Excites Me


Dart, the new open source structured web programming language currently in technology preview, is making me excited about web programming again. I'm watching it closely, fully understanding it's extremely early in the game to make any predictions. However, at least I can say I'm hopeful that there's a team out there attacking the very real problem of "not enough complex and full featured web apps" by working on an a language/libraries/VM option for modern web apps.

My background

I am a Java developer in a past life, where I grew to love the rich libraries, composable and modular applications, helpful tools, and refactoring techniques. I am a web developer at heart, with a true love for browser based client side web apps. This dichotomy was a bit of an uneasy fit, as part of me wanted a language with more structure (enabling tooling and modularity), and the other part of me wanted the insanely quick iterations of web development and the native-to-the-browser experience.

Dart really strikes a chord with me as it seems like it can be a development environment that answers to both desires: structured development and web development. I can build modular, structured web apps which are assisted by tools while still targeting the browser for modern web apps.

Just the pure fact that I can refactor my web app is enough to get me to pay attention.

How does Dart help?

Dart has a familiar syntax to any Java or JavaScript developer. I know some people wanted Dart to be an esoteric and unique language, but Dart was built for mass adoption. It needed to be accessible by the average app developer.

Dart is a class based, single inheritance, language with interfaces and libraries. You can build a structured web app and compose it in a standard and well defined way. Most of those patterns and practices you learned in other class based languages are available to you. Perhaps best of all, the libraries built by one developer are accessible to another developer in a standard way. It's important to point out that classes are essentially optional, as Dart supports bare functions.

Dart is single threaded, but supports concurrency through isolates. This means Dart avoids the complexity of multi-threaded languages, yet can take advantage of ever prevalent multiple core machines. Isolates are inspired by Erlang actors.

Dart is optionally typed, perhaps the most contentious design decision. Understanding the constraints under which Dart is developed makes it clear why this is the right choice. Dart needs to compile to JavaScript and needs to be accessible to the millions upon millions of JavaScript developers. Forcing a type system, which would almost certainly be unsound anyway, introduces friction for the developer and the JavaScript compiler. However, types are very useful as annotations to tools, e.g. to allow refactoring, and for documenting libraries and interfaces. The types don't affect the running program, which is why they are optional.

Dart can start fast, due to snapshots. A Dart app's heap can be snapshotted and sent over the wire, significantly reducing application startup time. A browser, for instance, doesn't have to re-parse the application's code on page reload or startup.

Dart is batteries included, delivering much more than just a language. The Dart effort is a full attempt at making web developers more productive. The Dart ecosystem is working on a language, libraries, concurrency, a virtual machine, an editor, a documentation tool, a compiler to JavaScript, and even a UI framework. These are coordinated efforts, intended to address developer productivity from many different angles.

Dart is novel, introduces fun concepts like "classes are interfaces", isolate based concurrency, named constructors, factory constructors, and of course optional types.

Dart fixes the DOM with a Dart friendly DOM library that feels natural and refreshing. The Dart team has created a new HTML library for adding events, finding elements, adding elements, that takes advantage of Dart's syntax.

Dart is built by smart people. The team is lead by Lars Bak, who lead the V8 JavaScript VM team and previously worked on the HotSpot VM machine for Sun. The language spec is lead by Gilad Bracha, who previously worked on the Java Language Spec. Other team members have worked on different languages, virtual machines, web browsers, and development environments. This is a focused team with a serious drive to make web developers more productive.

How to get started

Dart is currently (as of 2011-11) in "technology preview", but you can play with it today. I recommend these steps:

  1. Read the Technical Overview
  2. Download the Dart Editor
  3. Read about the new DOM libraries for Dart
  4. Write some sample code
  5. Send feedback to the mailing list
  6. Subscribe to the News and Updates Atom feed and follow @dart_lang
  7. Write more code
  8. Send more feedback
  9. Repeat!


As a software engineer with exposure to many different languages and environments, Dart seems to hit a sweet spot for me. Dart is what I want to build my modern, structured web applications: a class based, single inheritance language with interfaces, optional typing, just enough sugar, and isolates based concurrency. Dart is a "batteries included" effort, aiming to deliver a language, libraries, editor, and virtual machine. Dart's ultimate goal is to help modern web developers more productive and deliver bigger and better web applications.

I am excited because Dart is an effort to make "programming in the large" easier for both structured and unstructured developers across the entire web. Anything that tries to make the modern web compelling for modern apps is exciting to me.


If you are interested in building modern web apps for modern browsers, and are looking for a more structured "batteries included" ecosystem, now is the time to look at Dart. It's early in the game, so your feedback has the chance to make an impact. Here's how you get started:


Popular posts from this blog

  • Sponsor:  Register today for  New Game, the conference for HTML5 game developers . Learn from Mozilla, Opera, Google, Spil, Bocoup, Mandreel, Subsonic, Gamesalad, EA, Zynga, and others at this intimate and technically rich conference. Join us for two days of content from developers building HTML5 games today. Nov 1-2, 2011 in San Francisco.  Register now ! This is the second article in a Box2D series, following the Box2D Orientation article. The Box2DWeb port of Box2D contains a nice example to show off the basics of integrating physics simulations into your web app. This post will provide a walkthrough of the example, explaining the high level concepts and code. First, let's see the example in action. The code for the above is open source and available on GitHub. It was adapted from Box2DWeb's example . Animating Before we look at Box2D, it's important to understand how the above simulation is animated. You might think setInterval or setTimeout is
  • In which I port a snazzy little JavaScript audio web app to Dart , discover a bug, and high-five type annotations. Here's what I learned. [As it says in the header of this blog, I'm a seasoned Dart developer. However, I certainly don't write Dart every day (I wish!). Don't interpret this post as "Hi, I'm new to Dart". Instead, interpret this post as "I'm applying what I've been documenting."] This post analyzes two versions of the same app, both the original (JavaScript) version and the Dart version. The original version is a proxy for any small JavaScript app, there's nothing particularly special about the original version, which is why it made for a good example. This post discusses the differences between the two implementations: file organization, dependencies and modules, shims, classes, type annotations, event handling, calling multiple methods, asynchronous programming, animation, and interop with JavaScript libraries. F
  • Angular and Polymer, sitting in a DOM tree, B-i-n-d-i-n-g. First comes components, Then comes elements, Then comes the interop with the node dot bind. Angular , a super heroic MVC framework, and Polymer , polyfills and enhancements for custom elements built on top of Web Components, can live harmoniously in the same app. This post shows you how to connect Angular-controlled components to Polymer-controlled elements via data binding. And we do it all in Dart . Angular and Polymer I get asked "Should I use Angular or Polymer?" a lot. My answer is, "Yes". That is, both libraries have distinct strengths, and you can use both in the same app. Polymer excels at creating encapsulated custom elements. You can use those custom elements in any web app or web page, regardless if that app is built with Angular, Ember, etc. Angular excels at application engineering, with dependency injection, end-to-end testability, routing, and services. Here are som