> -----Original Message-----
> From: Mauricio Giraldo [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 04, 2003 1:56 PM
> To: CF-Talk
> Subject: request vs application scope
> 
> >>In general, when using CFCs I would recommend creating the variables
> >inside the CFCs as instance variables upon invocation rather than
"look
> >out" of the CFC to external data.
> 
> The idea is to have users generate their own config file without
> "touching" the CFCs. How would you recommend this to be done?

I'm sorry - I wasn't clear.

You can have your "permanent" storage in whatever you like: ini files,
the registry, the database, etc.

But when you create (instantiate) your CFCs I generally like to copy
that data into the CFC for use.  In other words the CFC only looks out
of itself on construction then caches that data internally.

If it's just a config file you want then you have many options: CF can
generate and easily edit both XML and INI-style files.  You could also
store the information in a database.

As I said: when you instantiate the CFC you would query/read/parse this
source and create internal structures for the data.  The CFC would then
(in my opinion) feature "getters" and "setters" - methods allowing the
properties to be retrieved and manipulated.

When you run the "set" methods of object it would update both the
in-memory variables and whatever persistent store you're using.

You can also complicate this up if it suits your application.  You
might, for example, only update the in-memory data until a special
"Commit" method is called on the object - and then at that point add the
new/changed information to the persistent store.

Of course I'm new to all this myself so I may (and quite probably am)
completely off-base on the "right" way to do this in OO.  Hopefully
somebody with some more experience will chime in as well.

Jim Davis


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to