Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Idea/Foundation behind synchronization

Idea/Foundation behind synchronization
Thread Tools
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Jul 9, 2004, 10:59 AM
 
Hi,

I have a client/server application and I would like to provide support for synchronization so that a user running the client could "checkout" data, make changes to it on the road and then when they re-connect to the server synchronize the data. Before I dive in, I thought it would be good to get some general ideas about how I should go about doing this.

I thought that I could add a date variable to my model classes, like "lastModificationDate" and then when the user is synchronizing I could compare those dates. Does anyone have any other ideas or pointers?

Thanks for reading,
Ian
     
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Jul 9, 2004, 12:32 PM
 
Originally posted by macrophyllum:
Hi,

I have a client/server application and I would like to provide support for synchronization so that a user running the client could "checkout" data, make changes to it on the road and then when they re-connect to the server synchronize the data. Before I dive in, I thought it would be good to get some general ideas about how I should go about doing this.

I thought that I could add a date variable to my model classes, like "lastModificationDate" and then when the user is synchronizing I could compare those dates. Does anyone have any other ideas or pointers?
It's a good start. You should also have a unique id for each object and "synced to" file on the server.

The unique id is obvious - to resolve conflicts when the rest of the data in another object is equal. The "synced to" file records which user/computer has received this record. You need this to track deletions.

For example, say you want to delete a record while working on your PowerBook away from the server. So you delete the record. Then when you sync to the server, you want the server to delete the record, and all other machines when they sync next time.

But if you don't have that "synced to" file, the server will just copy the old record back to your PowerBook again when you sync next. By using that file, when the server gets to that record it can check and think "Hey! that guy had this record before, but not now, he must have deleted it." The server can then mark that record (using the unique ID) as "to be deleted" in its deletion file for any other machine that syncs with the server in the future.

Don't forget to include a "reset" option. If your PowerBook's data is hosed, you don't want it to delete every record on the server next time you sync. Have the default when creating a new data file be a directive that says "give me all the data on the server".

That's about all I can think of for now.
     
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
Jul 9, 2004, 01:38 PM
 
Thanks, that helps a LOT!

Hopefully I won't be back for more questions.

~Ian
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:40 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2