There's some argument about what actually goes on under the hood with
cfinvoke, but originally (in CFMX 6 days), calling cfinvoke creates
the CFC, then calls the method, then destroys the CFC.  If you're only
calling one method on the CFC that's fine, but if you're calling
multiple methods on the CFC, having the CFC created and destroyed each
time can add a lot of unnecessary overhead.

I've heard that even if you call cfinvoke repeatedly, behind the
scenes the compiler is intelligent enough to handle this and not
create and destroy the CFC each time, but I still wouldn't do it. 
Make the code more messy IMO--if you're going to use the object more
than once, instantiate it and call all the methods you need on the
instance.

Matt

On 5/9/05, Ryan Everhart <[EMAIL PROTECTED]> wrote:
> Daniel,
> In your opinion what is the best practice, using cfscript or cfinvoke
> to call a CFC?  I like CFINVOKE because it's  a lot less code, but I'm
> not sure.   Since I'm new to this I'd like to do it the best way from
> the get go.
> 
> Ryan
> 
> On 5/9/05, Daniel Elmore <[EMAIL PROTECTED]> wrote:
> > Since your not persisting that object across pages, it's not that big of a
> > deal. You could call it "obj" and it's just as readable. What's important
> > are the method (function) names. You should be using getters and setters
> > instead of the "this" scope. Easycfm will get you going on syntax and usage,
> > but IMHO, it will show you horrible architecture and design practices.
> >
> > In short, I think your code is fine, until you want to start designing
> > applications around objects (ie. OOP).
> >
> > - Daniel
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> > Of Ryan Everhart
> > Sent: Monday, May 09, 2005 4:33 PM
> > To: [email protected]
> > Subject: Opinions Needed: CFCs
> >
> > Hey Everyone,
> > I'm new at CFCs and I'm going off a tutorial I found on easycfm.com.
> > I'm needing you opinion here on how you would name the component below
> >
> > <cfscript>
> >        // create a componet object
> >        updatePass = createObject("component","cfcs/password");
> >        // now set the properties from our form
> >        updatePass.OldPassword = form.OldPassword;
> >        updatePass.NewPassword = form.NewPassword;
> >        updatePass.NewPassword2 = form.NewPassword2;
> >        updatePass.UID = client.UID;
> >        // now call the updatePass function to update the database
> >        updatePass.updatePass();
> > </cfscript>
> >
> > It's a simple update password component but I'm concerned that the
> > component I created in the the code here is the named the same as the
> > function the component is calling.  Is this bad programming?  What are
> > you thoughts on a better component name.
> >
> > Ryan
> > ----------------------------------------------------------
> > To post, send email to [email protected]
> > To unsubscribe:
> >   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> > To subscribe:
> >   http://www.dfwcfug.org/form_MemberRegistration.cfm
> >
> > ----------------------------------------------------------
> > To post, send email to [email protected]
> > To unsubscribe:
> >   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> > To subscribe:
> >   http://www.dfwcfug.org/form_MemberRegistration.cfm
> >
> >
> ----------------------------------------------------------
> To post, send email to [email protected]
> To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>    http://www.dfwcfug.org/form_MemberRegistration.cfm
> 
> 


-- 
Matt Woodward
[EMAIL PROTECTED]
http://www.mattwoodward.com
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to