Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

resolvermappings.png This post describes a design for implementing backwards-compatibility in deltashell.

Backwards-compatibility : The ability to open project files written by an older version of the application in the current application.

Global idea / setup

...

If you release a version which you want to support you should include a test reading a project file of that version. So when you release your plugin 1.5 you should write a test called ReadVersion1._5 in your plugin that reads a project that covers all possible mappings you have in your plugin. You should check you get everything back from the project as you expect it. The dsproj file is checked into svn and the test should work as nothing changed yet. All is well....

After a while you want to refactor your class A. You also change the mapping A.hbm.xml. But the test ReadVersion1.5 *_5 you wrote on release now fails because reading the old db with the new a.hbm.xml does not work! What to do? You can chose not to refactor A and do something else OR you could add a A.hbm.1.5.xml mapping that converts the old db to the new object. Once you check in that new mapping file *ReadVersion1.5 should use that specific file (instead of A.hbm.xml) and the test should pass again.

So for a plugin it boils down to this:

1 If you have a release with file-format changes write a test that reads in a project created with that release.

4 points:

Wiki Markup
*1 Write a ignored (not run on BS) test that can create a dsproj file with all persistent objects you have in your plugin. You create a 'representative' project here. Update this test as your plugin evolves and add the category **\[BackwardCompatibility\]*

Wiki Markup
*2 If you have a release with file-format changes run test 1) and copy the result to the release version. Write a test that reads in that project file and add the category \[BackwardCompatibility\]*

For example if you release 1.1 you should run the test of 1) and copy the result to project1_1.dsproj + data. Check in this project and write a test ReadVersion1_1 that reads this project. You will never change this checked in project again.

3 If the test of 22 If the test of 1) breaks add version specific mappings until the test passes again.

3 4 If you longer support a version delete the test and the mapping you created for it.