Just so you know, you can also use COAL to do something similar.

You just create an object out of COAL, and then you can access your
different libraries at the time you need them.

And all of cflib.org's libraries are already in COAL.

You can check out COAL here: http://coal.ryanguill.com/

On 12/7/05, Ben Nadel <[EMAIL PROTECTED]> wrote:
> Ryan,
>
> I store my UDFs in a CFC called UDFLib. The UDFLib then in turn composes its
> own sub libraries for easier code organization:
>
> // Inside the INIT for UDFLib
> THIS.Array = CreateObject("component", "udflib.ArrayLib").Init(THIS);
> THIS.String = CreateObject("component", "udflib.StringLib").Init(THIS);
> THIS.System = CreateObject("component", "udflib.SystemLib").Init(THIS);
> THIS.Validation = CreateObject("component",
> "udflib.ValidationLib").Init(THIS);
> .... etc ...
>
>
> Then I store the parent library in the APPLICATION scope, but inside of a
> ServiceFactory. I am new to OOP and not sure if this is the best method, but
> then in my page pre-request area I have
>
> REQUEST.UDFLib = APPLICATION.ServiceFactory.GetUDFLib();
>
> Then for anywhere on the page I can use calls like:
>
> REQUEST.UDFLib.Validation.IsEmail(FORM.user_email);
>
> Or
>
> REQUEST.UDFLib.String.ToMixedCase(qBlam.foo);
>
> Since the ServiceFactory is only created once and stored in APPLICATION and
> itself creates and stores one copy of UDFLib, then it gets cached while the
> application is running.
>
> Hope that helps at all.
>
> .......................
> Ben Nadel
> Web Developer
> Nylon Technology
> 6 West 14th Street
> New York, NY 10011
> 212.691.1134
> 212.691.3477 fax
> www.nylontechnology.com
>
> "Vote for Pedro"
> -----Original Message-----
> From: Ryan Duckworth [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 06, 2005 5:54 PM
> To: CF-Talk
> Subject: cfscript Common Functions and Best Practices
>
> Currently we have many functions that we use within cfscript.  We are
> storing them in the request scope (see 2 examples below).
>
>
> Here is what I am don't like about this approach:  Every page hit from
> every user is loading these common functions.  I personally am not
> convinced that the request scope is the best place for these types of
> functions.  I'm sure that many of you out there use functions of your
> own and from www.cflib.org.  Is the server scope a better place for
> these?  Should we only reload the functions if they are not already
> defined in the server scope?
>
> Thanks,
> Ryan
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226402
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to