I am doing some significant refactoring and feature-adding on a project, and have just broken backwards compatibility with my data. I did it by creating a bunch of subclasses from the class that I used to house my data in, and loading in old serialized objects no longer works..
What kind of pre-engineering or strategies do you employ to avoid these types of situations? Should I forget about serialization completely? It seems particularly prone to these sorts of problems.
I use XML. One of the little talked about aspects of XML is that it can be extended without breaking backward compatibility.
In other words...
<root>
<something one="1" two="2"/>
</root>
...from revision A, has no problem being backwardly compatible with...
<root>
<something one="1" two="2" three="3"/>
<somethingElse five="5"/>
</root>
...from revision B.