| To: | REALbasic NUG <realbasic-nug at lists dot realsoftware dot com> |
|---|---|
| Subject: | Re: How to handle prefs with OO |
| From: | Charles Yeomans <yeomans at desuetude dot com> |
| Date: | Thu, 31 Mar 2005 13:43:28 -0500 |
| Delivered-to: | realbasic-nug at lists dot realsoftware dot com |
| References: | <20050331145657 dot 6E66E8113B0 at lists dot realsoftware dot com> <b2f7f92d1021886259cac89592cee894 at gmx dot de> |
On Mar 31, 2005, at 1:20 PM, Beatrix Willius wrote: Am 31.03.2005 um 16:56 schrieb Thomas Reed <tareedlists at mac dot com>:On Mar 31, 2005, at 6:00 AM, Beatrix Willius wrote:How can I implement this better:I'm partial to Apple's solution to this problem in the Core Foundation on Mac OS X.Yes, I am aware of the Core Foundation stuff and use this already.If you're doing cross-platform work, though, you can mimic this behavior with a class that reads from a file into a dictionary pretty easily. Somebody (Kevin Ballard, maybe?) has a class for turning XML into a dictionary and vice versa, though I forget what it's called and have never used it.This looks like the way to be cross plattform.Beyond that, I wouldn't get complicated with it. You mentionedfactories and whatnot -- too messy. Not needed. Remember, whatever is accessing a particular preference should know what to do with it betterthan your abstracted preferences class!I have lots of code like: if MailClient = "AppleMail" then 'do something elseif MailClient = "Entourage" then 'do something else 'more mail clients, even more to be added end ifI really want to get rid of this. To add a new MailClient I need to change code in about 10 places. So I would like to know why is the factory approach is too complicated. It may not be for your problem. It looks to me like you need to introduce an object to represent a MailClient. I had an article in RBD some time ago on writing a preferences class that might be more along the lines of what you want. -------------- Charles Yeomans _______________________________________________ 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> |
|---|---|---|
| ||
| Previous by Date: | [ANN] Belle Nuit Subtitler 1.7 DVD authoring and Windows, Matthias Buercher |
|---|---|
| Next by Date: | Re: daydreaming, Dean Davis |
| Previous by Thread: | Re: How to handle prefs with OO, Beatrix Willius |
| Next by Thread: | Re: How to handle prefs with OO, Thomas Reed |
| Indexes: | [Date] [Thread] [Top] [All Lists] |