Sunday, January 1, 2012

CoffeeScript vs Google Dart



Learn Javascript



  • The best way to learn (and debug) Coffeescript

  • Dart is similar enough to JS but far less common. You will come across more JS than Dart.

  • To understand why CoffeeScript exists, and how Dart differs.

Use Coffeescript



  • CoffeeScript is out there in projects already, so there's community and experience.

  • CoffeeScript might come up at work sooner than Dart (esp. with Rails).

  • CoffeeScript is nice!

Check out Dart


If you understand Javascript, and use CoffeeScript, and have checked out Dart, you'll be in a good position to judge which hammer is best for the task. Most JS/CS knowledge should be transferrable to Dart, the other way around would be more difficult.




[But why the JavaScript generated by Dart is so HUGE ???] - Use Frog compiler instead of DartC to compile/generate smaller JavaScript.



While Dart is pretty neat and backed by Google, it has not be absorbed into the web-applications development community like coffeescript has (coffeescript is the suggested front-end development language of the Rails core team and the preferred front-end language of the ruby community). Coffeescript also has wider support tools and, in my personal opinion, more readability. However, if that does not have you convinced then you can take a look at this ‘Hello World’ program written in Coffeescript and compiled to Javascript then Dart compiled to Javascript (taken from this gist).


Long story short, Dart supposedly offers enhanced security in your front-end (hence all the added junk?) and is more catered to large-scale projects but I won’t be reaching for Dart in the near future. The language syntax is cool and liken to Java but all the useless generated code really makes it hard for me to understand what is going on under the hood. Why use 17K lines of code when 11 will do?


http://blog.brandonmathis.me/blog/2011/10/11/dart-or-coffee/

1 comment:

Rodrigo Moraes said...

Dart improved with more recent compilers. A Hello World has now 8 lines. See http://goo.gl/9Ja33