Best practices for upgrading user data when updating versions of software

iosobjective csoftware-updatesversioning

In my code I check the current version of the software on launch and compare it to the version stored in the user's data file(s). If the version is newer, then I call different methods to update the old data to the newer data version, if necessary.

I usually have to make a new method to convert the data with each update that changes user data in some way, and cannot remove the old ones in case there was someone who missed an update. So the app must be able to go through each method call and update their data until they get their data current. With larger data sets, this could be a problem.

In addition, I recently had a brief discussion with another StackOverflow user this and he indicated he always appended a date stamp to the filename to manage data versions, although his reasoning as to why this was better than storing the version data in the file itself was unclear.

Since I've rarely seen management of user data versions in books I've read, I'm curious what are the best practices for naming user data files and procedures for updating older data to newer versions.

Edit:
The 'date stamp' stemmed form a discussion here:

https://stackoverflow.com/questions/8104812/does-releasing-a-new-version-of-the-app-delete-files-of-the-older-one/8104906#8104906

Since the question is too open-ended, I should say I'm looking for the recommended procedures for upgrading user data between versions.

If possible, it would be nice to see iOS / objective-c practices, but it's not required.

Best Answer

Dates are helpful for when you need extra information about when something was happening. There is no harm to adding them to a file that already contains a version number.

However, you can not use a time stamp as the sole indicator of what version is running, therefore deciding what needs updating. Just because you released 2 updates in the last year does not mean that someone with an install date within that range is using one of those two versions. If the user gets a copy of the installer, they can hold on to it for future clean installs and expect the software to update itself instead of getting the newest version.

Related Topic