Google offers JavaScript programming tools

In a new step to make the Web a more powerful foundation for programs, Google is releasing Closure Tools that it says produce faster, better code.

With a project called Closure Tools, Google plans on Thursday to start helping developers who aspire to match the company's proficiency in creating Web sites and Web applications.

Google is a strong proponent of using JavaScript to write Web-based programs, part of its Web-centric ethos. Indeed, the company has pushed the language to its limits with services such as Gmail and Google Docs, and it developed its Chrome browser in part to enable JavaScript programs to run faster.

But writing, debugging, and optimizing heavy-duty JavaScript can be difficult--in part because a given JavaScript program sometimes works differently on different browsers. Google's open-source Closure Tools project is an attempt to help with some of these challenges.

The first in the suite of tools is the Closure Compiler, a software package designed to boil down a JavaScript program so it's smaller and runs faster. For example, a function named DisplayAddress() could be replaced with just a().

Along with the compiler come some extra tools that run in the Firefox browser. One, Closure Inspector, is an extension for Firefox's Firebug add-on designed to help programmers understand and debug the rewritten JavaScript--linking a() back to DisplayAddress(), for example. Another add-on for the Google Page Speed extension lets programmers see how much the compiler helped.

Google also plans to make the compiler available as a Web application hosted on its Google App Engine service.

The second element is called the Closure Library, a collection of prebuilt JavaScript code that lets programmers handle relatively sophisticated technology--arrays and string manipulation, for example.

Last are Closure Templates, more prewritten code to ease creation of JavaScript and HTML user interfaces.

In an earlier era, programming tools were expensive packages bought by a select few, but open-source software, new marketing strategies, and new business methods have made that approach the exception rather than the rule these days. Now programming tools are often a means to another end--encouraging programmers to produce the software that will make Windows or the Palm Pre useful and therefore popular, for example.

In Google's case, the objective is often to make the Web more popular because it sees more activity on the Web as corresponding directly with more activity on its revenue-generating search site. Among the high-profile projects to this end are Chrome, Chrome OS, and Android, all subsidized by Google's powerful search-advertising business.

One interesting contrast to Closure is another Google project called Google Web Toolkit. It's designed to accomplish some of the same goals as Closure, including paving over browser incompatibilities and producing high-performance JavaScript. But with GWT, coders write programs in Java that gets translated into JavaScript.

So one last question: why the name?

Google's reply: "Being a functional language, the concept of a function closure is fundamental to the JavaScript language."

About the author

Stephen Shankland has been a reporter at CNET since 1998 and covers browsers, Web development, digital photography and new technology. In the past he has been CNET's beat reporter for Google, Yahoo, Linux, open-source software, servers and supercomputers. He has a soft spot in his heart for standards groups and I/O interfaces.

 

Join the discussion

Conversation powered by Livefyre

Don't Miss
Hot Products
Trending on CNET

CNET's Christmas Gift Guide

'Tis the season for a gadget upgrade

Check out these 9 tablets you'll want to bring home for the holidays.