Make no assumptions about a user's location or environment
When classifying and storing data, make no assumptions about a user's location or environment. The user may have roamed to an entirely different machine, or is sharing a single machine with five other users, and your application will have no way of knowing for sure. Following the guidelines below will help you avoid many of the pitfalls associated with these types of assumptions.
-
Store essential user settings that must move with the individual in the user’s profile. Users that have to use your application on multiple machines don't want to lose
valuable time getting things the way they like and are accustomed to, each and
every time they log in somewhere else! If a user takes the time to configure
your application beyond the default settings, then your application should take
the time to make sure those settings are available to the user wherever he or
she may roam on the network.
-
Store non-essential user data in the local Application Data folder. Sometimes the data you have just won’t fit easily into any category, or more
likely fits into several. Consider settings that are specific to both a User and
a Machine. Where do they belong?
-
Use special folder CSIDLs as the default location for user created files. Backing up a user’s work and having that work roam with the user are important
features to many system administrators. By writing user’s files to the
appropriate special folder CSIDL by default, your program will instantly be able
to take advantage of IntelliMirror’s roaming user features and you’ll always
write the files to the location the administrator has chosen.
-
Provide hard-coded defaults for all application settings. Finally, something it's okay to hard-code! Whether it's due to a disk error or an administrator's security settings, you may not be able to depend on access to the registry or local drives. Since your program may not be able to read any settings, you'll need to have usable defaults on hand to fall back on.
-
Store application-specific data as common to all users or machine-specific. In the past, most application settings unrelated to the user were placed in HKEY_LOCAL_MACHINE without much further thought given as to whether those settings should be administrable, or stored at all if they don't vary from the defaults. Furthermore, application data that was in reality common to all users of an application (such as a dictionary) may have been installed locally into every user's individual profile.
-
Data Placement Decision Tree. This chart helps with the decision of where to put user and application data.