Why Dart Excites Me

Intro

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!

Summary

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.

Resources

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

Lists and arrays in Dart

Converting Array to List in Scala

Null-aware operators in Dart