The 'utils' CFC instance is a property of the CFC, accesible via getUtils(). The UDFs aren't copied into the variables scope directly.
To take things the next step up, in an app you often have "peer" CFCs that need to know about each other, as well as standalone library-type CFCs that all the others need to know about. If all the CFC instances are created by a factory, then you can just pass that factory around and each CFC can get what it needs when it needs it, rather than passing around individual instance (like the utils object). I.e. factory.cfc has getUtils, getUserService, getNotificationService, etc. Each of those CFCs has an init() method that takes a reference to the factory that saves it to a variable, and then within it you can say variables.factory.getUtils().myUDF(), or variables.factory.getNotificationService().sendUserNotification(...). Bump that up one more level, and your factory object becomes a single element in your larger application configuration object. So your CFCs receive a 'config' object, with things like DSN, mail server, your object factory, and whatever else. So now you have a single "thing" that you can pass to all your application objects, and it has everything any of them need. cheers, barneyb On 10/30/05, Scratch <[EMAIL PROTECTED]> wrote: > > Hey Ryan, > > Why the additional getUtils() function rather than just referring to the > functions as variables.myUDF()? That method wouldn't be used outside the CFC > would it? > > Baz > > Suggestions so far: > > 1. Pass the function library to each CFC that needs it. > > -- 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). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
