Google offers JavaScript programming tools
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."
Stephen Shankland writes about a wide range of technology and products, but has a particular focus on browsers and digital photography. He joined CNET News in 1998 and since then also has covered Google, Yahoo, servers, supercomputing, Linux and open-source software, and science. E-mail Stephen, or follow him on Twitter at http://www.twitter.com/stshank. 





Speaking of compressing things, I need to go compress 700+ divs in to a loop.
1. packaged & deployed as a local Android app.
2. compiled to optimized JavaScript, etc. & deployed as a web app.
If so, that capability alone makes GWT sound like a great tool.
For pure JavaScript programming, the Closure Tools could turn out to be quite interesting.
LOL. ;-)
- by manalagi001 November 5, 2009 12:01 PM PST
- Closure compiler failed, can't compile large .js files. It's large .js files that most need minification and optimization!
- Like this Reply to this comment
-
(7 Comments)Closure templates' utility escapes me. Seems overwrought. Examples are rife with presentational elements. And it requires adopting new tools and new syntax? No thanks.
Closure library is undeveloped and poorly documented. I think we're better off sticking with YUI or JQuery.
However, Chrome and the developer tools within Chrome, such as the various inspectors and step-through Javascript debugging, are a boon to javascript developers.