English 中文(简体)
Best Practices for Self Updating Desktop Application in a network environment
原标题:

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 personal opinion.

I m aware that this question could be considered subjective, but I m not looking for personal opinion, rather facts with reasons (e.g. past experience) or even a single link to a blog/wiki which describes best practices for this (this is what I d prefer to be honest). What I m not looking for is how to make this work, I know how to create a self updating desktop application.

I want to know about the best practices for creating a self updating desktop application. The sort of best practices I m especially curious about are:

  • 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?
  • How often should you check for updates? Weekly/daily/hourly and exactly why?
  • Should the update be visible to the user or run behind the scenes from a UI point of view?
  • 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)
  • Should you try to patch the application or do you re-download the entire application from scratch Macintosh style?
  • Should you allow users to update from a central location or only allow updating through the specified application? (for closed business applications).

Surely there is some written rules/suggestions about this stuff? One of the most annoying things about a lot of applications is the updating, as it s hard to find a good balance between "out of date" and "in the users face".

If it helps consider this to be written in .net C# for a single client, running on machines with constant available connectivity to the update server, all of these machines talk to each other through the application, and all also talk to a central database server.

最佳回答

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

问题回答

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.

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.

  • 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.
    • 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.





    相关问题
    How to catch a LostFocus event in client-side code?

    This is really a dumb newbie question, but I am still learning the ropes of ASP.NET, and I couldn t work this one out by myself... < blush> I am working with a 3rd party control (Telerik ...

    ASP.Net: word creation/manipulation at client side

    I have a asp.net web app. On click of a button on a web page,I want to create a new MS word document on the client machine and show some data fetched from the server in it. Client can make changes ...

    Expand all items in RadGrid Hierarchy

    I am using a RadGrid (2009 Q2) with a hierarchy. Is there a way in the client api to expand all rows and vice-versa? thanks! Update: I have written a javascript function based off the api ...

    热门标签