Google Gear Vs Java Ajax


While I was discussing with a few programmer friends who have subscribed to my blog, a really creative idea comes out from our discussion and I am proud of that.

Discussion are important and allows programmers to expand their knowledge. They are like distributed computing, many brain works together on a topic hence Volla!!! a creative result.

Don't we agree that its a world of Ajax ? Gone were the days when for every HTTP request a page refresh is required.

Ajax allow programmers to provide user friendly and desktop like experience. Google has contributed many efforts into web based applications, which provides desktop like functionality example Google Doc, spreadsheet, gmail etc.
A part google contribution they have created Google gears, which is getting popular between many vendors even wordpress (one of the biggest bloggging platform) now uses google gear to speed up the user interaction.

Talking about Ajax and Web 2.0 based rich (business)application I have also written couple of well known articles on it as well

Design of Rich Internet Applications
Comparison between Rich Internet application and traditional web application
Top 8 principles for HCI and RAI Applications

Ok, like I said before when me and my fellow subscribers were discussing about Ajax, google gear and java. We decided to find out the alternate of google gears because we all are java programmers and gear api is in javascript and java is more powerful then javascript as well (thats my love for java) :P

So lets dive into the anatomy of Google gears and show you how java can replace google gear.....Ready ?

Google gears have three main component mentioned below

1) LocalServer

2) Database

3) WorkerPool

LocalServer caches and serve application resources (HTML, JavaScript, images, etc.) locally.The localServer module is a specialized URL cache that the web application controls. Requests for URLs in the LocalServer's cache are intercepted and served locally from the user's disk

Database Store stores data locally in a fully-searchable relational database. It is used to persistently store an application user's data on the user's compute

WorkerPool make web applications more responsive by performing resource-intensive operations asynchronously (a.k.a provides threading like functionality though they are not threads).The WorkerPool API runs operations in the background, without blocking the UI. Scripts executing in the WorkerPool will not trigger the browser's "unresponsive script" dialog.

After discussion what we found out is mentioned below

We all know about applets right ? We will use java applet as a service provider for all three functionalities which google gear provides. Yes Sir, applets are not all about GUI, they can be used headless.

With the help of integration between javascript and java we will achieve this kind of functionality

Alternate of LocalServer in java lets call it javaLocalServer:

javaLocalServer can cache and serve application resource, it will depend upon how developers are going to store it, for example developers can cache resources in HashMap or in a DB.
For every request to any resource javascripts will call java function which will search resource locally and if not found then it will fetch from network.

Alternate of Database Store in java lets call it javaDatabaseStore :

For this we choose Java DB a.k.a apache derby. Sun has already announced Java DB is included in the Java SE Development Kit from java 1.6 onward though I am not sure about the version.

Users with old version of java can download derby(which is very small in size) through web application. Now we got full database functionality on client side which provides way more features then google Database store

Alternate of WorkerPool in java lets call it javaWorkerPool :

In google gear workerpool provide asynchronous functionality to web based client, which can be achievable through java threads.

Through javascript integration with java, web developers can call functions of java classes and start a thread for time consuming process.

Now all we need is to sign the applet so that database can write on disk and up we go.

blog comments powered by Disqus