gettingstarted
[Top] [All Lists]

Re: Preferences

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Preferences
From: Seth Willits <seth at freaksw dot com>
Date: Wed, 30 Mar 2005 21:04:43 -0800
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <67 dot 41d03091 dot 2f7cd0e8 at aol dot com>
On Mar 30, 2005, at 8:04 PM, GAmoore at aol dot com wrote:

and simply run each line through a loop : grab the first two digits, then run it through a sieve of if statements. If I add a new preference, just put a
new If statement - and it won't hurt earlier pref files.

There's no need to do that even. Using a dictionary to contain your preferences, set all default values in the dictionary, read in preferences from the file (I use a custom binary format that has proved to work very well) and it sets values in the same dictionary. Then I just write the dictionary to disk. This is entirely forwards *and* backwards compatible. There's no need to write any code to add a new preference into the application at all other than setting it's default value. It's a piece of cake.




Seth Willits
------------------------------------------------------------------------ ---
President and Head Developer of Freak Software - http://www.freaksw.com
REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic

"Relations are simply a tedious pack of people, who haven't got the
 remotest knowledge of how to live, nor the smallest instinct about when
 to die."
    -- Algernon, The Importance of Being Earnest
------------------------------------------------------------------------ ---

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>