Google Goods at the Colorado Software Summit
This morning, I woke up early and attended Dion Almaer's talk on Google Gears. Dion works at Google in the Developer API group and is a member of the Google Gears development team. This presentation is called How to take your Web Application offline with Google Gears.
Dion starts with a video that Google Developers made. It's a parody of Dick in a Box, but it's called API in a Box. This was by far my favorite part of the presentation and it all went downhill from there.
Gears is a browser plugin that adds a database and a JavaScript API that allows applications to "go offline" and use these resources to store data. It does not do anything to handle synchronization of data back to the online database.
Gears has three modules as part of its API: LocalServer, Database and Workerpool.
The Database is embedded using SQLite. Google contributed Full Text Search to it and the entire database is 250K. Below is an example of how you might use the API:
var db = google.gears.factory.create("beta.database", "1.0"); db.open("database-demo"); db.execute("create table if not exists ..."); ... var rs = db.execute("select * from Demo order by Timestamp desc"); while (rs.isValidRolw()) { var name = fs.field(|); ... }
During the rest of the talk, I tuned in and out, but caught a number of interesting tidbits:
- GearShift - DB Migrations for Gears.
- Database Query Tool - one-page browser-based application that can be added to existing applications to add a query browser.
- Gears in Motion - full database tool for creating databases, modifying tables, inline-editing, etc. After building your database, you can export the SQL for use in a Gears application.
- Syncing is not a part of Gears because it's a very difficult problem to solve - especially when you have huge data.
- The best way to implement synching is to start simple, like Zoho Writer. It's like Google Docs, but allows you to read your documents off-line. The next version they're planning on allowing offline editing.
- You should plan on allowing your application to run - possibly by using cookies to store the data and create a "CookieBaseContent" implementation that gets chosen instead of "GearsBaseContent". In other words:
content = hasGears() ? new GearsBaseContent() : new CookieBaseContent();
- Debugging is a pain - you can simplify by using helper functions that allow you to clear the database.
- Google's Read/Write JavaScript API looks like some really cool stuff. It solves the cross-domain problem and is (at its core) a clever bundling of browser hacks. It's not specific to Google's APIs and can be used in any Ajax application.
- Gearsmonkey - uses Google Gears with the Firefox Greasemonkey plug-in to take other's applications offline.
- Dion uses Greasemonkey to add keystrokes to GMail and remove ads from Facebook.
- Wikipedia has an offline version that's powered by Gears. It uses iframes to cache pages with Gears and was developed by Google. It's unannounced by Dion didn't say I couldn't blog about it.
- Dojo offline has a sync framework.
- Vortex is an offline toolkit that builds on Gears.
- GWT has Gears support - all you have to do is drop a JAR in your classpath. If you don't like using Gear's JDBC-esque API - maybe you can use Hibernate with Gears?
Dion ended by talking about how Adobe Air is great for desktop-like applications that you can easily build with Ajax technologies. Silverlight is impressive, but only for media applications - you have to draw components yourself. Java Applets may make a comeback. The browser plugin has been rewritten to be fast as well as have full support for Java Web Start. It's possible that Gears + the Java Plugin can make it possible to use Java technologies (i.e. Hibernate or JPA) to talk to the browser's database. Firefox and WebKit are adding database components to their next major releases - so offline applications should become even easier to develop in the future.
Overall, this was a great talk - largely because Dion is a great speaker and made it fun and interesting.
After Dion's talk, I delivered my Web Framework talk and had some lunch while trying to get Rockies tickets (no luck). After lunch, I attended Bill Dudney's Comparing Spring & Guice talk. I learned some things about Guice I didn't know and enjoyed his comparison of the two Dependency Injection frameworks.
One question that Bill couldn't answer is how Spring 2.5's annotation support stacks up against Guice. Is it as full-featured as Guice? Does it add additional features and keep up with Guice for performance? What about wiring up objects without annotations - does it allow you to autowire your classes based on naming patterns without annotations in your code? What I'm hoping for is a DI framework that allows me to autowire classes using rules/conventions rather than annotations. I'm fine with using annotations for edge-cases, but it seems like a lot of the DI I do these days could be configured up-front and used for the entire application (rather than having to wire up each class).
Overall, it was a great day at the Colorado Software Summit.