Tuesday, October 16, 2012

On Dart

Dart was announced a year ago today. They celebrated by pushing out their "M1" (aka arbitrary milestone) release of their SDK today with a lot of cool tools and such.

The reaction is mixed. Many, including a commenter on HackerNews who I believe works at Google, ask "What is the point of this? Why is Google wasting their time with something no one will adopt?" Others think it's a significant development. One commenter on Reddit wrote "Dart- the language for the silent majority of programmers."

I agree with the second commenter, here's why.

"The silent majority of programmers" are the people are working in statically typed languages every day. C, Java, C++. They're not top commenters on Hacker News, they're not at Hackathons or Mongo meetups. These are the people who are going to lock into something like Dart and use it. Why do you think so many people took up Google's last statically-typed-browser-language-thingy GWT? It gives structure for programmers who are not used to dynamic languages. Tons and tons and tons of contractors I've talked to over the past couple years have used GWT in the enterprise.

For myself -- someone who actually is used to working in dynamic languages -- I like Dart because I recognize that Javascript is too unwieldy for the kind of very large web application development that is coming down the road. At some number of lines of code -- I have no set number for this, but it eventually happens -- Javascript becomes just too difficult to work with. It's so dynamic and unstructured that tooling cannot help you make sense of what's going on in the program. Can you imagine a million lines of Javascript? Me neither.

Big software engineering companies like Microsoft and Google seem to recognize this shortcoming. Dart and Typescript are both attempts to help correct this with the biggest feature being static type checking. Typescript looks good too, but Dart is a more ambitious attempt that includes a new VM, standard libraries and very robust tooling.

Look at it this way. If Javascript is C, Dart is C++. The goal is to add better type safety and more structure to better deal with larger programs. C++ was compiled to C for a long time via CFront. This is no different. For the short term, Dart will compile to JS. If Dart catches on, then the Dart VM will become more widespread. (The Dart folks might not like me comparing their language to C++ but C++ is a hell of a successful language and IMO a decent model to work from.)

Probably the most absurd thing I read today though is the notion that Google should be simply making a new cross-browser VM like the CLR or JVM and open sourcing that. This has a more difficult adoption path than Dart's proposition right now, where you can use Dart and ship it to any browser. And besides, it has been tried. Heard of Silverlight? That was the CLR, embedded into web browsers. That should have been the holy grail. You could write in Ruby, Python, and C#... in the browser... with .NET libraries available ... Microsoft made it available on all browsers ... and no one, anywhere, ever cared or used it. Maybe in 2004 it would have mattered if Google went that route, but not now. That ship has sailed.

So kudos to the Dart team. Nice job. It looks good.

No comments: