Google Gears

Standard

Google  gearslogo_153x43    which has been greatly talk about since its release by the web giant Google has spurred a lot of talk about how web application will be in the current and near future. Gears offers to provide features that are currently needed to speed up “heavy” (memory and data) intensive web application as well as provide off-line abilities.  Gear provides the following accents for web applications :

Local Database

This is used to stored user application data locally on the users computer, providing if not exactly, close off-line db store to OS desktop applications. Gears uses the open-source db SQLite for this functionality and supports normal SQL query.

 

Local Server

The local Serve allows you to cache application information on the client and and serve them locally instead of going back to the server. It can also to automatic updates for URL resource behind the scene.

  

Applications manage the cache using two classes:

  • ResourceStore – for capturing ad-hoc URLs using JavaScript. The ResourceStore allows an application to capture user data files that need to be addressed with a URL, such as a PDF file or an image.
  • ManagedResourceStore – for capturing a related set of URLs that are declared in a manifest file, and are updated automatically. The ManagedResourceStore allows the set of resources needed to run a web application to be captured.

For both types of stores, the set of URLs captured is explicitly controlled by the web application.

Serving and updating cached resources

The LocalServer intercepts HTTP/HTTPS requests and serves them from the cache when all of these conditions are met:

  • The URL is cached in a ResourceStore or ManagedResourceStore,
  • The store’s enabled attribute is set to true, and
  • If the store has a requiredCookie attribute, the request must have a cookie that matches. For further details read Cookies and the LocalServer.

The LocalServer always serves a cached resource when the conditions are met, regardless of the network connection. The URLs contained in a store are eligible for local serving without requiring the application to open the store.

To disable local serving of stored resources and force URLs to be served using the regular network connection, the application can set the store’s enabled attribute to false.

 

WorkerPool

This allows you application to spin off asynchronies processes (with JavaScript) without halting the browser or slowing its responsiveness.

 

These are all great features that web developer have  been wanting for many year now.  A co-worker asked “This is all great news but why do we need another 3rd party engine in our browser to make this happen. We already have flash and the upcoming Silverlight from MS “. Well, flash and Silverlight offer’s similar features like local data store but they also add the extra hefty runtime engine to make it all happen instead of improving the existing and most widely used tools (HTML , CSS, JavaScript etc) .

That’s not to say that Flash, Silverlight and others are about to be left in the dust. If the is one thing they “still” have over Goggle gears, it’s the fact that the UI presentation is the same in any browser. That take away the hustle of testing web application in multiple browsers due to different implementation of the W3C standards. This might change as  like IE (with IE 8 coming up) are becoming more compliant then ever.

There is a lot of speculation as to what will happen to Gears or flash /Silverlight etc, but for now, a better solution for developing off-line web application (using our long existing knowledge of JavaScript, CSS, HTML ) have arrived and should be well noted. Gears is not for every application but if the features fits what you are looking for in your app, take a good look at it.

What does the R in Relation Database stand for?

Standard

A couple of days I was working on pushing some business forms out for users to enter some business data into our db. I have been at my current company for about 4 months and due to our busy season and my minimum understanding of business rules and already existing libraries used, i hadn’t had the time to get an end to end processing of data from the client-end down to the db. Well, I finally got down to the DAL using our custom DAL libraries and boom, i realized that the DAL allowed me to enter a child row in one of the tables without a parent entered as yet. I was shocked. How is that suppose to happen so I folded my sleeves and put on my SQL hat. A nanosecond into looking at the db, i realized that there were no constraint or relations on the tables. They were just free standing table. I panicked, called for a meeting with my team to find out why. This was the answer
“The database is an object persistence storage and not a relation database”.
It took me a while to understand the direction they were coming from which probably exist in the J2EE world where most of the business logic and rules are lifted to the Business and Data Layer. I still get shivers when i think of it. That brought me to the bigger question,
“What does the R in Relation Database stand for?”.
For people like me who build application from database upwards which is what code generation tools like Codesmith and Linq rely on to also generate your DAL, it was hard to reverse the direction and go from UI, BAL, DAL to just Business Object Persistence db. I still will build up in the heart beat because the db is the final line for your process and it integrity does not exist in the db, human/developer error in code will filter down to the db. What you end up getting is a DB with many orphan’s and more. Im getting use to doing it from top to bottom now and we will be migrating to fully relation db next year after we roll out our current version.