Let me start by saying I am NOT an OO expert. PLEASE remember that. :)

To me, this doesn't break encapsulation because the CFCs are all in
the same package, so it makes sense that they would use one another.

As for flip flopping, I hear ya. Every other app I make using CFCs
does things a bit differently. You can see this clearly if you look at
my DRK apps. I'm still trying to find the best way myself.


On Sun, 14 Nov 2004 19:14:56 -0600, Dawson, Michael <[EMAIL PROTECTED]> wrote:
> Ray, doesn't this break encapsulation by putting the cfinvoke call
> _inside_ another component?  I'm still trying to learn the OO way, and I
> keep flip-flopping about best-practices and/or easier programming.
> 
> M!ke
> 
> 
> 
> -----Original Message-----
> From: Raymond Camden [mailto:[EMAIL PROTECTED]
> Sent: Saturday, November 13, 2004 5:55 PM
> To: CF-Talk
> Subject: Re: cfc - cffunction question
> 
> But (normally), extends should only be used to create a "Is A"
> releationship. Settings doesn't match this rule. Just in case it wasn't
> too obvious for others, here is a super simple example of what I'm
> talking about. Please note I did not include attributes like
> output=false, hint, var statements, etc, just to make things tighter:
> 
> settings.cfc:
> <cfcomponent>
> 
>     <cffunction name="getSettings" returnType="struct">
>         <!--- set a bunch of vars, or load them from the db, or an xml
> file, or whatever --->
>         <!--- simple hard coded example here --->
>         <cfset var settings = structNew()>
>         <cfset settings.dsn = "moo">
>         <cfreturn settings>
>     </cffunction>
> 
> </cfcomponent>
> 
> foo.cfc:
> <cfcomponent>
> 
>     <cfinvoke component="settings'" method="getSettings"
> returnVariable="variables.settings">
> 
>     <cffunction name="getStuff">
>         <cfquery name="stuff" datasource="#variables.settings.dsn#">
>         select whatever
>         </cfquery>
>         <cfreturn stuff>
>     </cffunction>
> 
> </cfcomponent>
> 
> What's nice then is that your Application.cfm can use the same cfinvoke
> statement to get global settings, although it would use
> returnVariable="application.settings". So now both your CFCs and your
> outside code all use the same method to get their settings.
> 
> On Sat, 13 Nov 2004 17:47:57 +0200, Murat Demirci <[EMAIL PROTECTED]>
> wrote:
> > For your specific situation you can use <cfmodule> in your
> > cffunction(s) or develop a global component which creates
> > variables.settings internally and extend it.
> >
> > Murat.
> >
> >
> >
> > > -----Original Message-----
> > > From: Charles Heizer [mailto:[EMAIL PROTECTED]
> > > Sent: Saturday, November 13, 2004 2:12 AM
> > > To: CF-Talk
> > > Subject: cfc - cffunction question
> > >
> > > Hello,
> > > I was wondering if it was possible to do a cfinclude in a cffunction
> 
> > > tag?
> > >
> > > I have a globals.cfm file which has site wide variables set and I
> > > want to reference them with out using cfinvokeargument tag.
> > >
> > > I hope this make sense,
> > > Thanks a bunch,
> > > - Charles
> > >
> > >
> > >
> >
> >
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184262
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