Google’s Battle for the Browser: JavaScript or Dart?

Dart targeting JavaScriptGoogle is behind one of the newest and most interesting battles in web development: the future of Web scripting. Though JavaScript is only halfway through its teens and maturing rapidly, there are some at Google who think the better way is with a new browser programming language called Dart.

In the blue corner is Microsoft who argue that gentle nudging is all that’s needed with tweaks to EcmaScript (aka JavaScript) which they are proposing. These proposals including adding numeric and string functions to fill in the gaps.

Against them in the red corner is Google with the Dart programming language. Originally called Dash, the goal of Dart is “ultimately to replace JavaScript as the lingua franca of web development on the open web platform. With the usual Google panache they already have early stage tools for developing Dart, including a compiler to generate JavaScript and an Eclipse based open source Dart editor that uses the compiler.

Google developers have argued that JavaScript isn’t really up to the task any more. Developers have created many different frameworks but it’s up against performance limits and development tools aren’t really that great apart from Firebug. This is not a new approach to this problem; Google developed the Google Web Toolkit to let developers create complex applications in Java that generate JavaScript as output.

Google are also pursuing a second lower risk strategy they call Harmony of evolving JavaScript. The risk being that if no one else adopted Dart it would fail. Some elements of Harmony will be available in Chrome.

Having spent a fair amount of time programming in languages other than JavaScript, I definitely favor the Dart approach which is a more classic OOP approach rather than JavaScript’s Prototyped objects. Despite Google and both Mozilla’s and, more recently, Microsoft’s efforts,  JavaScript is not a good language to build complex applications in.

All the speed ups, led by Google, have drastically improved JavaScript’s performance but it still lacks proper objects. Convincing not just the other browser manufacturers but everyone who has written a complex JavaScript app to consider changing to Dart is a challenging task not helped by the push back from Microsoft, Apple (Safari browser) and Mozilla. If developers favor Dart over JavaScript though that might get them to reconsider.

For those who think JavaScript needs little work, I’d cite CoffeeScript as a counter example.  That’s one way to improve JavaScript but it is really making the language look nicer, not altering it that much.

Also we haven’t heard what Opera thinks about Dart. Although Opera currently has the smallest share of users, adopting Dart might give it the traction to gain significant market share.

Taking a long view, it seems certain that both will co-exist for the next 5-7 years. But if  developers see just how much better (in terms of complexity, user experience) that new web apps can be if written in Dart, then it deserves to get wider take up. There are already third-party websites for Dart appearing (e.g. Dartr.com0. Ultimately it’s down to web developers to judge which language to use.