I actually use #2 a lot (cept, I wrap script around all that)...
I find it easier to work with. However, I'd still like to know peoples
thoughts on pushing a component into the request scope.
Just to clarify:
<cfscript>
x = createObject("component","test");
request.x = x;
</cfscript>
Now .. 'request.x' is available to even other cfcs without having to make
an additional invoke/createObject call.
~Todd
On Fri, 7 Jun 2002, Raymond Camden wrote:
> I think the question can be made a bit more broad - what is better:
>
> 1) <cfinvoke component="test" method="x">
>
> or
>
> 2) <cfset x = createObject("component","test")>
> <cfset y = test.foo()>
>
> In general my feelings are that if you are going to do anything more
> than call one method, you should use #2. It should be quicker (since you
> have the object already), but more than that, it's handier to have the
> object around I would think.
>
> Of course, since CFCs have been out for just a little while now, what I
> think makes sense now will probably change by next Tuesday. ;)
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, June 07, 2002 10:08 AM
> > Subject: Opinion: CFC / Request scope question.
> >
> > So, I'm pretty familiar with CFCs and getting it to work,
> > etc. I learned
> > that you can actually store a function within the variable
> > scope (in fact,
> > I learned that when you create a UDF, it's actually placed in
> > the variable
> > scope). I also recently learned that you can push a component of an
> > object inside a variable as well (via CreateObject();).
> >
> > I created a 'logging' component that all it does is takes an argument
> > (event_id) and it checks the db if it should log the event
> > and / or notify
> > someone of the event. I pushed this logging component into
> > the request
> > scope and it's now available to all my applications (even other CFCs).
> >
> > I guess my question is, is this a bad thing to do? What's
> > the impact of
> > pushing components into the request scope (besides
> > memory)...? I know
> > there's this holy war going on regarding the 'request' scope as some
> > people say it shouldn't be touched and other people claim
> > that's what it's
> > for.
> >
> > Just looking for opinions...
> >
> > Thanks,
> > ~Todd
> >
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists