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


Groups > comp.programming > #1542

Re: config pattern

From Rui Maciel <rui.maciel@gmail.com>
Newsgroups comp.programming
Subject Re: config pattern
Date 2012-05-05 13:15 +0100
Organization Aioe.org NNTP Server
Message-ID <jo35kg$q55$1@speranza.aioe.org> (permalink)
References <2136283.53.1336143092105.JavaMail.geo-discussion-forums@ynjc8>

Show all headers | 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