Saturday, November 7, 2009

Google opens up its JavaScript development toolbox to all

Google opens up its JavaScript development toolbox to allGoogle is providing the web development community with an intriguing glimpse under the hood at some of the fundamental building blocks of the company's most popular web applications. The search giant has opened the source code of its comprehensive JavaScript library collection and is making it available to third-party developers for widespread adoption. Google also opened the source code of its own JavaScript compression tools.

The library, called Closure, includes an extraordinarily diverse assortment of capabilities with functionality ranging from JSON serialization to standard user interface widgets. All of the features are cross-browser compatible and can be readily adopted without marginalizing any users. The library consists primarily of helper functions and user interface widgets, many of which are recognizable from popular Google applications.

The library fills some of the gaps in JavaScript and has features that ameliorate a number of the language's historical weaknesses. For example, it has a mechanism that brings conventional object-oriented inheritance to JavaScript. It also provides a namespace system and support for module loading with dependency resolution. The source code is distributed under the Apache License and is available for download from the Google Code web site. The company has published API reference documentation and some introductory tutorials to help prospective adopters get started with the library.

In addition to opening the library, Google has also announced the availability of the Closure Compiler, a JavaScript compression and optimization tool with a number of advanced features. In addition to optimization and compression, the compiler can also conduct basic code analysis to help identify certain kinds of programming errors. Like the library, the compiler is open source and distributed under the Apache License.

It is built with the Java programming language and can be used from the command line or through a web interface provided by Google. The web interface allows developers to simply paste their JavaScript code into a text field in their browser, click a button, and get a downloadable compressed version of their script. A REST API is also available for programmatically automated use of the hosted compiler. A special Firebug plugin called the Closure Inspector is provided to help debug the compressed code. It will map expressions in the compressed code to the relevant line in the original code.

The release of the Closure library and compiler were announced today at the Google Code blog.

"[Closure] started as 20% projects and hundreds of Googlers have contributed thousands of patches. Today, each Closure Tool has grown to be a key part of the JavaScript infrastructure behind web apps at Google," the Closure team wrote. "That's why we're particularly excited (and humbled) to open source them to encourage and support web development outside Google. We want to hear what you think, but more importantly, we want to see what you make."

There is obviously a lot of overlap between Closure and other popular JavaScript libraries such as Dojo, but it still offers a lot of unique value. Closure Compiler is also compelling and appears to be competitive with other JavaScript compression solutions.

No comments:

Post a Comment