Shailen Tuli's blog

Thoughts on coding in Dart, Ruby, Python and Javascript

Why Use Dart?

| Comments

Building web applications is hard. Building large web applications is a real challenge. Given this, I am super excited by the emergence of Dart as a structured web programming language for building applications for the modern web.

I am mostly a Ruby and Python hacker. I have spent the last few years doing web programming and this means that I have spent a lot of time writing Javascript. I really like coding in Javascript: I like its (mostly) coherent OO/functional hybrid syntax, I find it expressive and I like to make use of its rich and rapidly evolving ecosystem of frameworks and libraries.

Javascript started off as small language for animating mostly static web pages. As the web has evolved, Javascript code-bases have become larger (my last project, a Rails 3 app using Backbone, had more Javascript than Ruby code in it). Large codebases require careful use of code reuse and organization if they are to scale; through the use of ‘classes’ and inheritance, the module and sandbox design patterns, popular MVC frameworks like Backbone and Angular, Javascript developers have sought to bring more structure to their code.

I very much view Dart as a logical next step in this quest for greater code organization. The Dart project is a serious - and long awaited - attempt at creating an alternative to writing web applications using Javascript; it is likely to appeal to those who want to retain the relative ease of current web development, but want a language with more structure than what is available to them today. Building large web applications has been quite daunting - even heroic - and Dart aims to make the development process easier. Dart is a “batteries included” project (the language comes with libraries, a package manager, an editor, and a VM) and Dart code executes fast, making it an attractive option for modern web development.

Here are a few salient points about Dart:

  • Dart is open source
  • it has a syntax that is likely to be familiar to most programmers
  • it is relatively easy to learn
  • it compiles to javascript that can be run in any modern browser
  • it can also be executed directly using a Chromium-based browser (nicknamed Dartium) that includes the Dart virtual machine (VM)
  • it can coexist with javascript through the use of the interop library
  • it runs in the client and the server
  • it comes with a lightweight editor that you can use to write and debug applications
  • Dart programs run fast (many of the people who created Chrome’s V8 are leading the Dart project)
  • it offers concurrency through the use of isolates
  • Dart has optional static type anotations that can help you organize your code, provide better debug messages in the editor and act as documentation
  • it comes with batteries included: an HTML library for DOM manipulation, an IO library and a unittest library
  • it encourages modular code organization through the use of libraries
  • it has a package manager (pub) so you can integrate code from across the Dart ecosystem

Is Dart going to change how we write web applications? While its still early - the language just had its M1 (Milestone 1) release and is still not at the 1.0 stage - what I see so far is super encouraging.

Comments