Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #1533 > unrolled thread

config pattern

Started bybob <bob@coolfone.comze.com>
First post2012-05-04 07:51 -0700
Last post2012-05-05 13:15 +0100
Articles 3 — 3 participants

Back to article view | Back to comp.programming


Contents

  config pattern bob <bob@coolfone.comze.com> - 2012-05-04 07:51 -0700
    Re: config pattern joseph@thehomeoftime.com - 2012-05-04 21:14 -0700
    Re: config pattern Rui Maciel <rui.maciel@gmail.com> - 2012-05-05 13:15 +0100

#1533 — config pattern

Frombob <bob@coolfone.comze.com>
Date2012-05-04 07:51 -0700
Subjectconfig pattern
Message-ID<2136283.53.1336143092105.JavaMail.geo-discussion-forums@ynjc8>
What is the best and/or most common way of handling persistent config data?  Is it to make a Config singleton class or a class of static variables or something else?

[toc] | [next] | [standalone]


#1536

Fromjoseph@thehomeoftime.com
Date2012-05-04 21:14 -0700
Message-ID<18253942.288.1336191270165.JavaMail.geo-discussion-forums@ynei5>
In reply to#1533
On Friday, May 4, 2012 10:51:32 AM UTC-4, bob wrote:
> What is the best and/or most common way of handling persistent config data?  Is it to make a Config singleton class or a class of static variables or something else?

Depends on the language, but if I can I use a static class. I like to do it lazy, where the configs load the first time you need them and they stay accessible and loaded.

[toc] | [prev] | [next] | [standalone]


#1542

FromRui Maciel <rui.maciel@gmail.com>
Date2012-05-05 13:15 +0100
Message-ID<jo35kg$q55$1@speranza.aioe.org>
In reply to#1533
bob wrote:

> What is the best and/or most common way of handling persistent config
> data?  Is it to make a Config singleton class or a class of static
> variables or something else?

I don't know if it is the best way to handle config data, but I tend to 
store the value of all config options in a single structure/record.  No 
fancy tricks are actually required, as there is no need to enforce the 
existence of a single object and when a component requires config data it is 
simply passed to it as needed.

The only trick I believe may be required is to put in place 
callbacks/observer pattern to signal any change to any config option, which 
would make it easier to propagate config changes.


Rui Maciel

[toc] | [prev] | [standalone]


Back to top | Article view | comp.programming


csiph-web