A look inside Google Gears

Company describes development history of new tool for running Web applications offline

Google Inc. began with a deceptively simple notion when setting out on the path that led to this week's unveiling of  an early release version of the Google Gears tool — making the Web work without being connected. The tool aims to help developers build Web applications that work even when their users are offline.  

However, the Google quest to "make the Web better" was not as clear-cut as it sounds now, said Andy Palay, a member of the Gears development team.

Palay described the hurdles faced during the development of the new open-source tool during Google's first Developer Day, which was held on Thursday simultaneously in 10 cities worldwide.

With Gears, Googlers were initially looking to take away one of the primary barriers to their suite of Google Apps — that users had to be online to use its Web-based e-mail, calendars and other applications, Palay said.

At the start, the development team wondered if it was too late to tackle the problem, Palay acknowledged. "You can hardly go anywhere today and not have an Internet connection, or so the claim is," he said. "[But] users don't like the notion of 'I am almost always connected.'" Users want data when they want it, not only when they can connect to the Internet, he added.

In addition, Palay noted that online network reliability and performance come into play with Web applications. For example, users often encounter problems connecting in hotels whose networks might not be constantly available in every room, he added.

He also observed that Web applications don't perform as well as desktop applications because data has to make a round trip to the server and back.

When the Google development team looked at the large spectrum of ways to make Web applications available offline, it opted "to do just enough to make it work" and then work with other vendors to develop a standard for browsers, Palay said.

That approach, the team figured, would allow it to do for offline Web applications what XML and HTTP requests did for Web browsers -- "all of a sudden enabling an explosion of new Web applications," Palay said.

Google decided to offer Gears for Internet Explorer, Firefox and Safari and to open its source code so that the tool could benefit from a community of developers and vendors, Palay added. The team also decided to offer support for the Windows, Macintosh and Linux operating systems, he said.

"The fundamental piece of this really amounts to bringing your data locally to your machine," he said. "You have the local data in a local store -- changes get made by the UI through that local data store. Changes are queued up so they can be synchronized with the server [when a connection is made]."

To that end, Google opted to build Gears with three main components: a local server to access the application offline, a local database to store large amounts of unstructured data, and a worker pool architecture to perform long operations.

The local server uses one cache that is controlled by the application, Palay said, noting that a traditional cache is controlled by the browser. A second cache is used to ensure that Gears can capture updated versions of applications as they change, he said.

In keeping with the open-source focus of Gears, Google opted to use the open-source SQLLite database "We wanted the footprint of Gears to be small," Palay said. "Even though [SQLLite] is small, it handles large amounts of data."

What are the results of Gears effort?

Google demonstrated Thursday that its Google Reader feed reader now can be used offline, with users able to star and tag portions of a feed that will automatically sync back up with the Web version of the Reader when a user connects again.

In addition, Kevin Lynch, senior vice president and chief software architect at Adobe Systems Inc., demonstrated how Apollo — Adobe's tool for taking rich Internet applications across different browsers and offline — worked with the new Gears API in a sales dashboard.

"All that data that is coming from the server is now cached on my computer, and now I can use this wherever I am," he said. "Now you as developers can use same API in the browser and on the desktop."

Copyright © 2007 IDG Communications, Inc.

7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon