Google releases Dart

10 October 2011

Today on the 10th of October 2011, Google released Dart, its new "Structured Web Programming" language. It's been said it is Google's aim to replace JavaScript with Dart as the main built-in prgramming language of browsers.

The goal of the Dash (which was later renamed to Dart) effort is ultimately to replace JavaScript as the lingua franca of web development on the open web platform.

This is confirmed by a leaked e-mail from Google stating that they are going to replace all JavaScript with Dart in theire own aplications. They even got a tool to convert JavaScript code to Dart which will not work comepletly automatic, but will speed up the process of replacing all JS code.

Dart is at the time of writing supported by a few browsers (Chrome, Safari 5+ and Firefox 4+) but they say it will be supported by other browsers soon.

This is what Google says about Dart:

Dart is a new class-based programming language for creating structured web applications. Developed with the goals of simplicity, efficiency, and scalability, the Dart language combines powerful new language features with familiar language constructs into a clear, readable syntax.

This means that the language should ve very easy to learn and allows you to create maintainable code. This is to be achieved by implementing classes (which enables OOP), Optional types (set a variable to a fixed type. Or not), Libraries (which are guaranteed to never change?) and lots of tools to make programming easy (like advanced debugging tools).

The hello world of Dart looks like this (sorry, no code highlighting yet):

main() {
  print('Hello, Dart!');
}

At first glance, it looks really easy. When viewing the syntax for a class it still looks very intuitive:

class Greeter {
  var prefix = 'Hello,';

  greet(name) {
    print('$prefix $name');
  }
}

main() {
  var greeter = new Greeter();
  greeter.greet("Class!");
}

I was able to change this supersimple class to do what I want, without looking at any documentation, so it's quite intuitive as I can see so far. So webdevelopers with any experience in programming languages like JavaScript or PHP can switch to Dart quite easy. Google even says:

Dart was designed to look and feel familiar if you're coming from other languages, in particular Java and JavaScript. If you try hard enough, you can use Dart just like it was one of those languages.

I'm curious where this will go... At first it feels like "oh no, not another thing we need to take into account! After all those browsers, CSS and HTML versions! Please stop making our work more difficult than it allready is!", but I think Dart might bring us an easier and more versatile language which enables us to create even more awesome websites. Because that's what it's all about: creating awesome stuff.

No it will not replace JavaScript any time soon, but it can be a good alternative for JavaScript. As longs as all browsers inplement it the right way it can become like jQuery; finally an easy-to-understand syntax which works exactly the same across all browsers and platforms.

Update 1

John Resig, creator of jQuery, tweets this about Dart:

Why is Google putting time and effort into changing JavaScript when the DOM is what needs fixing?

That makes me think...

Update 2

After a few days more people have looked into Dart and are writing blog posts.

http://webreflection.blogspot.com/2011/10/what-is-wrong-about-17259-lines-of-code.html

http://www.quirksmode.org/blog/archives/2011/10/dart_or_why_jav.html

Update 3

Aral Balkan expresses his thoughts on Dart too: http://aralbalkan.com/3931

And after reading more and more, and seeing an "hello world" example compile into more than 17000 lines of code, my conclusion can only be:



Sources & more info

http://www.dartlang.org/articles/idiomatic-dart/

http://en.wikipedia.org/wiki/Google_Dart

http://www.2ality.com/2011/09/google-dart.html

http://www.extremetech.com/computing/99175-google-dart-unveiled-farewell-javascript
You must have JavaScript enabled to use this form!

Leave a comment!

  1. Your mail is safe with me. It's only only used to display your Gravatar image!

1 comment

  1. Johan van Tongeren Gravatar

    Luc

    13 November 2011

    Thanks for updates 2 and 3... completely new way of looking at it and I agree with you. 17000 lines of code for Hello World seems way too outlandish and i'm pretty happy with the performance and functionality of Javascript right now. Fingers crossed that Dart isn't going to slug-up my Chrome setup...