Tuesday, October 16, 2012

What's Dart's best feature, and what has been built with Dart?

I was speaking at LondonJS last night (which, btw, is a great event if you can get tickets - they go within an hour of being announced - thanks to the organizers for inviting me).  I went with the understanding that most of the dev's in the room had seen Dart at some point in the past (probably when it was launched a year ago), and this was the time to bring people up to speed with some of the great features of Dart from the last year.

LondonJS talk summary

My slides were minimal and live code demos were plentiful, first covering the Dart tools, including Dart Editor and Dartium, pub, packages and libraries, unit testing, dartdoc, and dart2js.

Next up was sharing code between the client and server, and running server-side Dart, followed by a demonstration of building web components with model driven views and shadow DOM in Dart.  A few of the audience had seen last week's London Ajax talk on web components by Alex Russell, and this provided for an interesting discussion about how the web might look in a few years after building components using shadow DOM.

Finally, there was a quick demonstration of Dart's Javascript interop story, demonstrating that you can have Dart code interacting with JavaScript code, including jQuery.

Unfortunately the talk wasn't recorded, but I'll be creating some blog posts / screencasts about the various sections of the talk over the coming days.

Darts best feature?

I was asked what Dart's best feature was.  The answer, in my opinion, is structure.  As a developer who has come to programming through Turbo Pascal, Delphi, C# and Java, I've been "spoiled" by having great tools with which to build applications, and great tools need a language with some form of structure to support features such as static analysis, type checking and refactoring.  Dart's type system allows these kind of tools to flourish.

With structure comes the ability to scale a project, terms of complexity and team size. Having used GWT to provide this capability in previous projects, the benefits of this next iteration of web development become very clear.  When there are multiple developers, of varying skill and experience levels, having a common set of tools and a language that is able to enforce good practice is a great start.
"Dart provides that language structure by design, rather than by accident"
One of the JS developers said something along the lines of "I always create structured JavaScript" - That's great - and if everyone wrote JavaScript in a highly structured and consistent way, then there would probably  not be a need for Dart.  Unfortunately, JavaScript language structure comes from convention rather than construct, and not enough people follow the same convention (Doug Crockford's book should be mandatory reading for JS developers imho).  Dart provides that language structure by design, rather than by accident, and this language structure is utilized by the tools that developers will use, and also by the VM and dart2js designers to provide optimizations with the ultimate goal of better performing apps for everyone.

The view seemed to be that those who love JavaScript, will still love JavaScript, but those developers who are used to more structured languages, and are frustrated by JavaScript (and there are many of those developers, as demonstrated by Microsoft's recent typescript release), will gain from using Dart.  Whether you are building the next generation browser game, or line of business applications, your app will grow in size, and you will be thankful for the structure and type annotations that Dart allows.

What has been built in Dart?

The Dart language has been moving over the last year - 11 releases of the language spec over the year pretty much means that code that was written a year ago isn't 100% compatible with the code you would write today.  Dart was launched as a tech preview one year ago - this implies that the language will be changing.  Throughout these changes, however, a number of applications have been built by the Dart team and the rest of the community, and many of these applications are built into the Dart ecosystem.  Tools such as Pub, DartDoc and dart2js are all Dart applications, and many other libraries exists on the community packages page of this site, such as the Buckshot UI library, which stands at many thousands of lines of code.  As always github is a great resource for discovering Dart language projects.

Dart's M1 release firms up the language

"now is the ideal time to start building your next big application with Dart"
With Dart's M1 milestone release imminent, the Dart language will become more stable.  My understanding is that while the dev team still reserve the right to make breaking changes, these changes should become less frequent.  This means that now is the ideal time to start building your next big application with Dart.



Check out my book, Dart in Action from Manning.
All chapters are complete and the early-access version is
 available from manning.com (affiliate link)

3 comments:

  1. Will there be an updated Dart Milestone monitor extension for Chrome?

    ReplyDelete
    Replies
    1. I don't see why not - give me a few days, and I'll update it for M2

      Delete
    2. It would be really nice to have an updated version, thanks!

      Delete