Hi,
zeitue wrote:I get your point on the data types and how all data is just 1s and 0s.
Maybe I am biased against binary configurations, because of Windows Registry?
If Windows Registry was stored as XML rather than binary, would that fix any of the problems with Windows Registry?
zeitue wrote:but I still would worry about having everything in one system, and one for each user, binary files.
I'd worry about that too. For example, it makes it hard to copy one application's settings from one computer to a different computer (without a whole pile of additional/unwanted stuff).
I think it'd be better to define the goals of the system (what it should achieve), and then worry about how it achieves those goals afterwards.
For example; you might want 2 sets of settings - the default settings (for all users) plus the current user's settings (where the user's settings override the defaults, and if the user happens to be using the defaults then there's no reason to store the same data twice). You could add a few generic rules to this (e.g. make it so that only the system administrator can modify default settings); and the OS's own settings might be handle slightly differently (e.g. no user settings at all).
I'd also have separate files for different applications. This means that you might have an application called "foo", with a "/sys/default/foo.cfg" file containing the default settings, plus a "/home/Brendan/.config/foo.cfg" file for my settings and a "/home/zeitue/.config/foo.cfg" file for your settings. If you want to copy your settings for application "foo" from a computer at work to a computer at home then you'd copy your "/home/zeitue/.config/foo.cfg" onto a USB stick or something and then copy it onto your computer at home. If you really wanted to get fancy, you could use something like NFS and mount the same file system at "/home/zeitue/" on several different computers (so if you change your settings on one computer then use a different computer, the other computer uses the new settings).
Next, (regardless of how settings are stored - binary or plain text) I'd want something to describe what different settings mean. For this reason I'd want applications to provide another file that describes settings. For example, an application called "foo" might have a file "/apps/foo/config.desc" that says things like:
Code: Select all
value1 = "This is the timeout (in milliseconds) to wait for network connections before retrying."
This means that you can have some sort of utility (even if it is a fancy text editor) that can display the description of different settings when the user hovers their mouse pointer over it or something. Of course if you want internationalisation, then you might have a different file for different languages - one for English descriptions, one for French descriptions, one for German descriptions, etc.
Next, I'd want something to determine acceptable values for settings. For example, an application called "foo" might have a file that says "the data for 'value1' is an integer that must be positive, and must be between 1 and 100". That way you can have some sort of utility (even if it is a fancy text editor) that checks if values entered by a user are actually sane (e.g. and tells the user there's a problem when they want do "value1 = -8" or "value1 = chocolate"). Let's call this a "setting limits" file.
After this I'd consider is how the "configuration editor" will look to end users. I'd really want something graphical (e.g. dialog boxes), with things like text boxes, drop down lists, checkboxes, etc. The "configuration editor" can use information from the "setting limits" file to determine how to generate the dialog boxes (e.g. if something should be a text box or drop down list or whatever), and can use information from the "description file" (for whichever language) to provide a help system and maybe even the names of variables (e.g. "value1" might be called "Network Timeout" in English). It'd also need to be able to determine if a user's setting is the same as the default setting. For example, the "configuration editor" could load values from the default file, then load values from the user's file to override the defaults; and later (when saving after changes were made) could find the difference between the new data and the defaults and only store the differences.
After deciding how the "configuration editor" will look; I'd decide on file formats. There's 3 different types of files to worry about - configuration data itself, "description files" and "setting limits files". The description files could be plain text (and possibly should be plain text, as this makes it easier for internationalisation). For the "limits files" (created by application developers), I can't see any reason to use text files - application developers are smart enough to (e.g.) write a set of macros to generate their limit files (if you don't provide the macros), and eventually I'd hope someone builds it into a fancy IDE of some sort to make it really nice for developers. For the settings, the end users would be using your configuration editor so they won't need plain text at all, and software will be using your data/resource manager (e.g. application "foo" might ask your data/resource manager to find the current user's data for "value1") so software won't need plain text for anything either.
Cheers,
Brendan