471,334 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,334 software developers and data experts.

Serialization versions

I was curious to know if anyone has suggestions about maintaining various
versions of class definitions when using serialization to save data.

Is there a "standard" way of handling backward compatibility with previous
version file structures? I don't have problems within the program itself,
just with loading data from files created with previous versions of the
class definition. It seems that if a change as minor as changing a property
name, even if the value type and behavior remain the same, it's no longer
compatible with files created using the previous structure.

Here's what my original plan was:

1. Incorporate the version information into the file names (In this program
all files are managed automatically through the program and the user really
never uses the file name)

2. Create a new class definition each time I need to modify the class,
leaving the previous versions of the class definition in tact. The new
definition would have a modified class name to reflect the version.

3. Use the appropriate class definition when reading in the data and perform
any conversions required at that time.

4. Save the file using the latest class definition and modify it's name to
reflect the change.

This seems like a lot accounting of work, am I missing something obvious?
I'll end up with quite a few versions of the class definition used in this
program to store the data. Is it unusual to use serialization to save and
retrieve data this way? Unfortunately it's very difficult right now to nail
down the final class structure as request for new capabilities are handled
and incorporated into the program.

Any comments and/or suggestions are greatly appreciated.

Thanks,
Dave
Jul 21 '05 #1
0 736

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

37 posts views Thread by Ben | last post: by
4 posts views Thread by mdb | last post: by
3 posts views Thread by Zachary Turner | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.