XML and Registry

windows-registryxml

Which method is considered to be best practice for setting storage for applications: XML or Registry? What are the benefits/downsides of using either of these?

Best Answer

The registry is Microsoft's solution to storing application information relative to a user. The advantages of this include:

  • Being able to hold application settings for each user of the computer.
  • Having an API already available for using this feature.

However the disadvantages include:

  • Platform dependent.
  • Limited to the amount of information for a single block of data.
  • Loss of portability (you lose settings when you install on another machine)

I personally vouche for using XMLs if not merely for the fact that it allows you to copy the entire application to another computer and have it work fine with the same settings. Plus, if you write your application flexible enough, you can write entire projects onto XML files, something I wouldn't dare attempt with a registry.

It's convenient initially to use the registry, but it's far better in the long run to use XML files in my opinion.