It's nothing more than a single object that has a reference to
EVERYTHING in the app.  So you can ask it for static config options
(getProperty("dsn")), or for a factory (getFactory("gateway")), or
whatever else your app needs.  Most importantly of all, since it's
both an encapsulated object and a singleton, any updates to it
magically propogate to everywhere it's used in the app.  If you have
smart users, it can also be used to reload pieces of the app but not
others.  Hypothetically, if you needed to change your DSN mid-flow,
you could update the config object, and then all the dependant objects
would notice, and take whatever actions.  The gateway factory, for
instance, would notice, and not return any cached instances any more,
instead creating new ones that use the new DSN.

This object status is very important, because during initialization,
you end up with the scenario of having to pass the config to a CFC's
constructor before the entire config is built (because that CFC
instance has to be added to the config).  Perfect example is a factory
object.  However, since the config is an object, properties that are
added after it's passed to the constructor will still be available.

I stole the idea from Mach-II, primarily, and tweaked things around to
better suit a general app config, rather than the Mach-II framework
specifically.

cheers,
barneyb

On 9/9/05, Anthony Israel-Davis <[EMAIL PROTECTED]> wrote:
> 
> I really like the idea of a config object, but I'm having trouble
> picturing it.  Could you give me a simple idea of what it looks like?
> And how it is used in code - I don't need anything fancy, just a general
> idea of what kind of methods are contained in it (if anything beyond
> init?) It sounds like it just sets a bunch of variables, which makes
> sense to me - is there anything else to it?
> 
> Thanks!
> 
> Anthony
> 

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 100 invites.


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to