| By Eric Farrar | Article Rating: |
|
| August 3, 2008 09:00 AM EDT | Reads: |
1,534 |
Up until recently, Web applications were "connected-only" applications. Users could only use the application by connecting to the central server and all data access was done in a single place. For many years, people accepted that was the limitation of Web applications. But it isn't a limitation any longer.
Over the past year a number of technologies have come along such as Adobe AIR and Google Gears that allow offline access to the data and the application. This is a huge boon to Web developers who, up until now, were hampered by the offline problem of Web applications. Both of these solutions employ a local, lightweight database to serve and store the data while the application is offline.
Migrating your "connected-only" application to an "occasionally connected" application will likely require significant architecture changes to facilitate the change tracking and conflict detection needed for synchronization. It's extremely important that all the architecture changes are considered, and that a synchronization strategy is designed carefully from the start.
To illustrate the complexities that occasionally connected applications bring, and to exhibit the sort of architecture changes that may be required, this article will focus on only one problem: How do you create and uniquely identify data that's created while offline?
While this is among the simplest of the synchronization problems that you'll encounter, it provides an excellent example of the changes you must consider when designing occasionally connected applications.
Why Good Old Auto-Increment Isn't Enough
To be able to synchronize and detect conflicts, all of the data records must have a unique identifier that distinguishes them from all other records. In the database world, this would be called the record's primary key. When a new record is created, it must be assigned a unique primary key to ensure that it can be uniquely identified across all instances of the application. In a centrally accessed system, the most common way to generate unique values is to use an auto-incrementing integer. Each created record is assigned a primary key that's one greater than that of the last created record. But this fast, simple method that works so well for connected-only applications simply doesn't work for occasionally connected ones.
To show why it doesn't work, consider an application that lets multiple users share a single contact list between them. The master version of the contact list resides on the central server, and a copy of that list is stored in the local database of each user's application. Assume that two users, User A and User B, synchronize their contact list with the server at the beginning of the day and then proceed to work offline. Later, while working offline, each user adds a new contact to his application. What value should they use as a primary key? Auto-incrementing seems to work fine on the server, so what happens if auto-increment is used in the offline applications? The answer: collisions.
Published August 3, 2008 Reads 1,534
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
About Eric Farrar
Eric graduated from the University in Waterloo in Computer Engineering. He has worked in many industries including Wall Street financial (Morgan Stanley), automated manufacturing technology (Automation Tooling Systems Inc), and information technology (Platform Solutions Inc). He is presently a Product Manager at Sybase iAnywhere.
- Ulitzer’s Amazing First 30 Days in Public Beta
- iPhone OS 3.0 Hits the Streets Today
- Is the PR Business Extinct? Yes
- SOA, Cloud Computing & Live Mesh: A Day in the Life of Ivan Eyepack 2009
- Ellison at JavaOne: Myths About JavaFX, Android, and J2ME
- Ulitzer vs. Ning - a Quick Review
- Seven Steps to the iPhone Developer's World
- Forget Cloud Computing, Let's Talk About Ed Zander
- Ted Weissman and Lois Paul & Partners PR Firm
- Sony Ericsson W705 Highly Capable Music Phones
- Ulitzer’s Amazing First 30 Days in Public Beta
- iPhone OS 3.0 Hits the Streets Today
- Palm Unveils webOS Mobile Platform and Pre Phone
- Nokia E71 Black Review
- iBank Mobile Announces iPhone App for Tracking Personal Finance
- Is the PR Business Extinct? Yes
- Sun CEO Reviews Company's Prospects for 2009-10
- Volante Announces Java-Based, Wireless Linux POS Solution
- $10 Indian Laptop a Lot of Hooey
- Telecommunications Providers Face New Availability Standards, Driven by Consumers
- i-Technology Viewpoint: Should RIM BlackBerries Be Rented?
- Trump's Apprentice Runner-Up Rebecca Jarvis Has $150,000 Job Offer From SYS-CON Media
- Microsoft and Sprint Collaborate on Mobile Search
- "Mobile Web 2.0" – How Web 2.0 Impacts Mobility & Digital Convergence
- Ringback Tones
- Mobile Music Gets Boost From New W600 "Walkman Phone"
- i-Technology Blog: Zero-Cost Telephony, the 6-Ton Elephant in the Telco Room
- Alcatel + Microsoft = Internet TV Over IP, a.k.a. "IPTV," Coming Soon To a PC or TV Near You
- SIMply Big: SIM Cards For New Mobile Personal Storage
- Mobile Device Solutions: Synchronizing Mobile Devices







































