Barry, Not sure what you mean by "wind up a new helper instance within the CFC". Do you mean copy methods from one CFC to another:
objB = CreateObject("component", "B").init(); objA = CreateObject("component", "A").init(objB); <cfcomponent name="A"> <cffunction name="init"> <cfargument name="helper" type="any"> <cfscript> // Could loop over metadata to do this for all methods this.method1 = arguments.helper.method1; this.method2 = arguments.helper.method2; // etc. return this; </cfscript> </cffunction> </cfcomponent> as opposed to: <cfcomponent name="A"> <cfinclude template="B.cfm"> <!--- B.cfm defines UDFs method1, method2 etc ---> <cffunction name="init"> <cfreturn this> </cffunction> </cfcomponent> Neither lets you realistically introspect A (which is the main drawback of mixins IMHO), but I guess at least in the first case you could introspect B separately. > yet to be convinced using cfinclude's within a cfc is worth the hassle.... What hassle? Jaime Metcher > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Barry > Beattie > Sent: Thursday, 1 February 2007 12:28 PM > To: cfcdev@cfczone.org > Subject: Re: [CFCDEV] Closures, mixins, and udf includes > > > is there anything wrong with having the common methods as CFC's that > are wound up with the CFC that you're working with? decorate it with > additional functionality? > > if you don't want to wind up a new helper instance within the CFC, how > about passing in a reference to the common methods CFC's in the init > of the CFC that you're working with? Perhaps it's just a reference to > a application-scoped singleton which itself is decorated with > functionality? > > the only time I've warmed to the idea of cfinclud-ing within a CFC is > pulling in descrete SQL within methods, and even then gnarly > micro-logic can make that really messy (looking for null arguments and > conditional processing - if "" then query other field). > > yet to be convinced using cfinclude's within a cfc is worth the hassle.... > > > On 2/1/07, Jaime Metcher <[EMAIL PROTECTED]> wrote: > > cfinclude inside a CFC is how mixins are implemented, yes? So are you > > saying mixins smell bad? > > > > Jaime Metcher > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Rose, > > > Mitch > > > Sent: Thursday, 1 February 2007 7:44 AM > > > To: CFCDev@cfczone.org > > > Subject: [CFCDEV] Closures, mixins, and udf includes > > > > > > > > > Hi Folks, > > > > > > Syntactically, at least, I think I understand the differences, and I'm > > > guessing most of you would agree that using cfinclude within a cfc > > > 'smells bad'. > > > > > > But I'm unclear as to why one would choose one approach over another. > > > Could some smart folks with experience here could speak to > the pros and > > > cons of each, and how usage might differ? > > > > > > Thanks > > > -m > > > > > > > > > You are subscribed to cfcdev. To unsubscribe, please follow the > > > instructions at http://www.cfczone.org/listserv.cfm > > > > > > CFCDev is supported by: > > > Katapult Media, Inc. > > > We are cool code geeks looking for fun projects to rock! > > > www.katapultmedia.com > > > > > > An archive of the CFCDev list is available at > > > www.mail-archive.com/cfcdev@cfczone.org > > > > > > > > > > > > > > > > You are subscribed to cfcdev. To unsubscribe, please follow the > instructions at http://www.cfczone.org/listserv.cfm > > > > CFCDev is supported by: > > Katapult Media, Inc. > > We are cool code geeks looking for fun projects to rock! > > www.katapultmedia.com > > > > An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org > > You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org