hi,
I have been thinking about best approach to support backward compatibility.
What's your opinion? I would like to learn from you if you have a working
approach or you know of a good strategy.
I had been thinking the two approach as below. but, they are less than
ideal.
Option 1: Create a driver internally for each version.
Pros:
Use to choose which version to use.
Upgrade is by choice.
Retire old version easily and cleanly
User could specify which version of the driver they
want to use.
Cons:
A lot of duplication in code.
Bug fixing become cumbersome across multiple versions
Option 2: Standardise the data structure for all version.
approach: Make the new argument optional. Ignore old
argument that is no longer required.Hide deplecated argument in kwargs.
Pros: Upgrade is seemless
Cons:
Handle multiple scenarios to cater for backward
compatibility. if version x, do this; if
version Y, do that....
It will only works only if new property is optional
in request. Removal of a mandatory property will be problematic.
One could easily get lost in the data structure
corresponding to each version
Cheers,
Sam