Structure:
Server - Desktop Application
I would like to have an auto update mechanism on the desktop application. This can be achieved with stuff like Squirel.Windows, and is outside the scope of this question. Just a side note the DesktopApp has multiple variants for different OS (Mac and Windows).
The problem is, that the server is not always the latest version. For instance:
Server.v1 - DesktopApp.v1
Server.v2 - DesktopApp.v1
Server.v1 and Server.v2 has different behavior and breaking changes. How do I structure the auto update on DesktopApp in a managable way?
Server version can also suddenly go to a different version, for instance from Server.v2 to Server.v1. It is outside our control.
NOTE: The server does not comply with semver, so minor version numbers can have breaking changes
Suggestion 1)
Make DesktopApp backwards compatible like this
if(serverVersion == Server.v1) {
MetodOfLogicThatWorksOnV1();
};
if(serverVersion >= Server.v2) {
MetodOfLogicThatWorksOnV2();
};
Now I can freely update DesktopApp.v1 as much as I want and it will be completely backwards compatible. Users of the Desktop application all use the latest version.
Worries: Could cause very complex logic after a while, making it prone to error
Suggestion 2)
Make DesktopApp update mechanic know when it should downgrade
if(serverVersion == Server.v1) {
DesktopApp.SelfUpdater.Update(v1);
};
if(serverVersion >= Server.v2) {
DesktopApp.SelfUpdater.Update(latest);
};
Now users will get different DesktopApp version depending on what version of the server they are connected to.
Worries: Users will have to update/downgrade depending on version. Will become complex to maintain this update logic. A bug fix will now have to be made on both DesktopApp.v1 and DesktopApp.v2
Suggestion 3)
Create 1 DesktopApp per Server version
if(serverVersion != clientVersion) {
DesktopApp.SelfUpdater.Update(serverVersion);
};
This means I know that the version of the Server will always be designed for the exact version of the DesktopApp I use
Worries: Extremely many version of DesktopApp need to be made, and bug fixes need to be deployed to many versions.
Question:
How can I structure auto updating a desktop application when you have multiple server versions, with breaking changes between each server version?