Best Practices for Self Updating Desktop Application in a network environment

后端 未结 5 657
慢半拍i
慢半拍i 2021-01-31 11:58

I have searched through google and SO for possible answers to this question, but can only find small bits of information scattered around the place, most of which appear to be p

相关标签:
5条回答
  • 2021-01-31 12:20

    It's hard to give a general answer. It depends on the context: criticality of the update, what kind of app is it, user preferences, #users, network width, etc. Here are some of the options/trade-offs.

    • Do you force an update if the clients software is out of date, but not going to break when trying to communicate with other version of the software or the database itself? If so how do you signify this breaking change?

      As a developer your best interest is to have all apps out there to be as up to date as possible. This reduces your maintenance effort. Thus, if the user does not mind you should update.

    • How often should you check for updates? Weekly/daily/hourly and exactly why?

      If the updates are transparent to the user, do not require an immediate restart of the app, then I'd suggest that you do it as often as your the communication bandwidth allows (considering both the update check-frequent but small-and the download-infrequent but large)

    • Should the update be visible to the user or run behind the scenes from a UI point of view?

      Depends on the user preferences but also on the type of the update: bug fixes vs. functionality/UI changes (the user will be puzzled to see the look and feel has changed with no previous alert)

    • Should you even notify the user that there is an update available if it is not a major update? (for instance fixing a single button in a remote part of the application which only one user actually requires)

      same arguments as the previous question

    • Should you try to patch the application or do you re-download the entire application from scratch Macintosh style?

      if app size is small download it from scratch. This will prevent all sort of weird bugs created to mismatch between the different patches ("DLL hell"). However, this may require large download times or impose heavy toll on your network.

    • Should you allow users to update from a central location or only allow updating through the specified application? (for closed business applications).

      I think both

    0 讨论(0)
  • 2021-01-31 12:22
    • Do not ever try to force an update unless your lawyers demand that. Show the the user a update notification she can either accept or ignore. Try not to spam the same version too much is she rejected it. The help her make the decision, include a link to release notes or a short summary of changes.
    • Weekly would be a good default update check interval but let the user choose this, including completely disabling update check from the web. Do not check too often because she might be on an expensive mobile data plan, or she just doesn't like the idea of an application phoning home.
    • The update check part should be completely silent. If an update was found, display a notification for the user. During download and installation, show a progress bar.
    • To keep this simple, notify the user about any newer version. If you do not want to annoy them with frequent updates including just a few minor bug fixes, do not release every minor version at the download location watched by the update checker
    • Maintaining patches for all previously released versions is too much work. If the download size becomes a problem, figure out some other way than patches to make it smaller (7-zip compressed self-extracting exe, splitting the application to multiple MSI packages that have independent versions etc)

    Two more things:

  • Do not implement the update engine as a process that is constantly running in the background even when I'm not using your application. My PC already ~10 such processes hogging resources, which is very annoying.
  • When updating the update engine itself, on one hand you need to have the engine running to show the installation progress UI but on the other hand the update process must be closed to avoid the reboot that would result from the exe file being locked. There are a number of things like running a helper program from %TEMP%, using Windows Installer restart manager, renaming the updater exe file before starting the installation package etc. Keep this in mind when architecting the update engine.

0 讨论(0)
  • 2021-01-31 12:28

    From practical experience, don't forget to add functionality for updating the update engine. Which means that performing an update is usually a two step approach

    1. Check if there are updates to the update engine
    2. Check if there are updates to the actual application

    Do you force an update if the clients software is out of date, but not going to break when trying to communicate with other version of the software or the database itself? If so how do you signify this breaking change?

    A common practice is to have a "ProtocolVersion" method which indicates the lowest/oldest version allowed.

    The "ProtocolVersion" can either supplied by the client or the server depending on the trust level you have between the client and the server. In a low trust level it is probably better to have the client provide the "ProtocolVersion" and then deny access server side until the client is updated. In a "high trust level" scenario it will be easier to have the server supply the "ProtocolVersion" it accepts, and then all the logic for adapting to this - including updating the client application - implemented in the client only. Giving the benefit that the version check/handling code only needs to be in one place.

    0 讨论(0)
  • 2021-01-31 12:31

    One best practice that many software overlook: ask to update when the user is closing your application, NOT when it has just launched it.

    It's incredible how many apps don't do that (Firefox, for example). You just ran the app, you want to use it now, and instead, it prompts you if you want to update, which of course is going to take 5 minutes and require restarting the app.

    This is non-sense. Just do the update at the end.

    0 讨论(0)
  • 2021-01-31 12:34
    • Do you force an update if the clients software is out of date, but not going to break when trying to communicate with other version of the software or the database itself? If so how do you signify this breaking change?

    Ask the user.

    • How often should you check for updates? Weekly/daily/hourly and exactly why?

    Ask the user.

    • Should the update be visible to the user or run behind the scenes from a UI point of view?

    Ask the user.

    • Should you even notify the user that there is an update available if it is not a major update? (for instance fixing a single button in a remote part of the application which only one user actually requires)

    Ask the user (notice a trend here?).

    • Should you try to patch the application or do you re-download the entire application from scratch Macintosh style?

    Typically, patch, if the application is of any significant size.

    As far as the "ask the user" responses go, it doesn't mean always prompt them every single time. Instead, give them the option to set what they should be prompted for and what should just be done invisibly (and the first time a given thing occurs, ask them what should be done in the future, and remember that). This shouldn't be very difficult and you gain a lot of goodwill from a larger portion of your user base, since it's very hard to have fixed settings suit the desires of everyone who uses your app. When in doubt, more options are better than less - especially when they're the kind of option that's fairly trivial to code.

    0 讨论(0)
  • 提交回复
    热议问题