Google Unveils Dart to Compete with JavaScript in All Browsers

Google Dart LogoDevelopers beware, there's a new scripting language for client-side Web programming. Designed for quick prototyping and compatibility across multiple browsers and platforms, Google introduced Dart at the GOTO Conference this week. GOTO is an international software development conference that strives for independence from vendors.

Google hopes Dart will become a standard in every modern Web browser. Currently, every Web browsers utilizes built-in JavaScript interpreters for performing various actions within the Web Browser. These actions can include popping up windows, checking data in forms before submission, and creating interactive elements on a Web page like tabs and some interactive site navigation menus.

Dart vs. JavaScript

JavaScript has been a staple in Web browsers since Netscape Navigator 2.0 came onto the scene in 1995. Since then, nearly every Web browser has incorporated a JavaScript interpreter to handle what are known as client-side interactions between users and Web pages.

Client-side Web programming refers to actions that happen in the browser using the Web surfer's computer to process the code. This differs from server-side programming, which is executed behind the scenes on a Web server, typically to help create the data that gets included in the page.

The Dart technical overview describes the design goals for Dart to:

  • Create a structured yet flexible language for web programming.
  • Make Dart feel familiar and natural to programmers and thus easy to learn.
  • Ensure that all Dart language constructs allow high performance and fast application startup.
  • Make Dart appropriate for the full range of devices on the web—including phones, tablets, laptops, and servers.
  • Provide tools that make Dart run fast across all major modern browsers.

This means Google's new language is similar enough to what Web programmers are used to, thereby easing the learning curve. However, they feel Dart will run faster, more smoothly and with less security risk than JavaScript.

According to a purported leaked internal Google memo, Google seems intent on positioning Dart to ultimately replace JavaScript as the default language built into all Web browsers. Google already has Dart support groups and code repositories established for the developer community.

According to their announcement, Google Software Engineer Lars Bak states Dart code will be executed in one of two ways:

  1. Natively in the browser (or other device) using a virtual machine that reads the code.
  2. Translating, using a compiler that will translate Dart code into JavaScript.

Will My Web Pages Work In Other Browsers?

Naturally, to maintain early adoption for browsers that don't support it (currently all of them), the compiler option is, at present, the only option. Using a compiler on-the-fly will always slow down code execution. Google, which is all about site speed lately, clearly knows this. Hopefully their Dart code is as efficient as they claim it will be.

Look for Dart natively in a future release of the Chrome browser. According to a recent CNET Interview, Google is already testing new ways of deploying Dart code using something called snapshotting. Through this process, they've trimmed down the load time of large Dart programs by over 90 percent.

A recent 55,000-line program written in Dart loaded in 60 milliseconds. That now makes a pretty convincing argument for developers concerned about speeding up the code execution.

Are you convinced? Will your Web team switch from JavaScript to Dart? Let us know in the comments below.