Have you seen your INI yet?

One of the top annoying parts of Windows application programming is storing user/program defaults settings. There’s a couple of ways to store this data: use the generic INI files, store data in the registry or (as many applications nowadays do) write this out to an XML file.

Under Delphi itself (and other programming environments), I generally resort to plain ini files: I’ve never seen any benefit in using the registry (bloat). While Microsoft at one stage recommended this central point of storage, nowadays it seems that they either want you to go back to ini files anyways or use different means.

But back to the original point of this posting: I have a faint idea when I started to dislike adding code to store user settings. It’s generally a repetive concept: for each single setting you generally end up writing twice the code (Write/ReadProfilestrings). Not to mention, the amount of code that needs to be plumbed into the application. I noticed that there are ‘formstorage’ components that take care of all of this: while this seems to be the fastest way to replace your line-by-line coding, it ends up to be the least efficient one too. That’s because at run-time it’s harder to decide which internal components’ settings you may need to throw out. My hats off to the ones that write these kind of code (it’s a neat technique), but next time, don’t bother. And hey, there’s a limit on the size of INI files size too (Windows API), which is probably why other developers flock to other means of data storage.

Which reminds me that I did the same kind RTTL processing in an e-mailer, just to facilitate multiple translations. Localization? Oh yes, that’s another one of those boring and annoying parts of programming.

This entry was posted in Ordinateurs. Bookmark the permalink.

3 Responses to Have you seen your INI yet?

  1. marc says:

    ok, so what’s the point?

    im my opinion the point is to stick to INI files.

    cheers

  2. Arthur says:

    im my opinion the point is to stick to INI files.

    The point is that it’s the most boring part of application development.

  3. alfons hoogervorst says:

    The only valid point against using the registry is that’s hard to change a setting quickly, as opposed to changing a setting stored in a text file.

Comments are closed.