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


Groups > comp.programming > #1542

Re: config pattern

Path csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From Rui Maciel <rui.maciel@gmail.com>
Newsgroups comp.programming
Subject Re: config pattern
Date Sat, 05 May 2012 13:15:14 +0100
Organization Aioe.org NNTP Server
Lines 18
Message-ID <jo35kg$q55$1@speranza.aioe.org> (permalink)
References <2136283.53.1336143092105.JavaMail.geo-discussion-forums@ynjc8>
Reply-To rui.maciel@gmail.com
NNTP-Posting-Host AqItoBXOUTdaiWbH4r55cA.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Complaints-To abuse@aioe.org
User-Agent KNode/4.8.2
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.programming:1542

Show key headers only | View raw


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

Back to comp.programming | Previous | NextPrevious in thread | Find similar


Thread

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

csiph-web