Pages

Friday, June 14, 2013

A Tale of two Web Technologies

Let's play a quick game: I'm going to describe a relatively recently announced web technology, and I want you to guess what it is.
  • It was developed by a generally well respected company that focuses on moving the web forward.
  • It was started to enable the web to move beyond the inherent limitations of javascript.
  • It allows developers to run applications programmed in a language other than javascript.
  • The company behind it encouraged others to join in its development, and has actively been improving it themselves.
  • It was designed so that when run in a specialized VM it could run much faster than an equivalent Javascript app.
  • To preserve backwards compatibility, however, the code is cross-compiled into standard javascript, allowing it to run on most modern browsers.
So if I stop there, what's your guess? If you've been keeping up with these things I bet you're probably thinking asm.js, which is a good guess because it meets all the criteria up above. Let me add one more hint, though:
  • When announced this technology was regarded with skepticism and vocal opposition.
Ah, that makes a difference. What's your guess now?

"What is Dart, Alex?"

Bingo! We have a winner!

[Update: I originally had an item in the list implying that asm.js had been developed behind closed doors. I've been corrected on this point, as the asm.js project was open source on Github since its inception. It would be more correct to say that it was not publicized until they had enough complete to accurately benchmark. Thanks to the folks on Twitter that pointed this out to me, as it paints a more complete picture of the reasons behind public attitudes!]

Look, I know that this is not an Apples to Apples comparison. But if we're being honest both of these technologies are motivated by similar goals: Javascript is too slow and awkward for the demands of really high performance applications. (Like, say, Unreal Engine 3?) I know that that statement alone will annoy the Javascript faithful, who come out swinging Atwood's law around like a club. I actually like Javascript, and would be willing to argue the same in most cases. But there's a certain class of applications that it simply was never designed to handle. Technologies like NaCl, Dart, and (most recently) asm.js are all attempts to fix that.

So, getting to the point of this post: I'm a confused as to why something like Dart, which I have found to be a great language to code in, inspires either annoyance or apathy from many web developers while the same crowd seems largely enthusiastic about asm.js. 

For my part I think they're both awesome technologies with different use cases. If I were building a new web app from scratch I'd want to code it in Javascript or Dart but would prefer Dart due to its cleaner syntax, built-in libraries, and potential speed. (Not to mention it supports things like SIMD which is awesome for realtime 3D!) If I had an existing iPhone or Android game that I wanted to bring to the web asm.js (or NaCl, which the caveat of browser support) provides a great tool for expanding my audience with the minimal amount of effort. Likewise for non-trivial, pre-existing C/C++ libraries. Different tools for different purposes, both useful in their own right and both trying to let us do more than Javascript allows for today.

So I'd like to drum up some discussion on this one: What's your opinion on these (or any other similar) technologies? Why do you like them or dislike them? From some of the feedback I've already heard it seems like there's may be some confusion about what these various technologies actually do, and if so I'd like to do my part to clear that up. I'm also trying to get a bit of the community pulse to help inform the direction of some future posts.

(Oh, and I promise that my next post will be far more interesting to WebGL developers! Got something really cool on the way!)