What pre-development do you do to ensure data compatibility for future versions of your application?

I am doing significant refactoring and adding features to a project and I just broke compatibility with my data. I did this by creating a bunch of subclasses from the class I was using my data in and loading old serialized objects no longer works.

What preliminary design or strategies do you use to avoid these situations? Should I completely forget about serialization? It seems especially connected with such problems.

+1


source to share


2 answers


I am using XML. One of the few aspects of XML discussed 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 backward compatibility issues with ...

<root>
  <something one="1" two="2" three="3"/>
  <somethingElse five="5"/>
</root>

      

... from revision B.

+1


source


Apart from the commonly used serialization mechanism, which is at least somewhat tolerant of change as dacracot describes, I am trying to tweak it so that I can do some customization of the deserialization process per class. It's ugly to have conversion code for old data formats hanging around, but not as ugly as losing everything you serialize.



0


source







All Articles