RE: Opinion: CFC / Request scope question.

2002-06-07 Thread Raymond Camden

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. ;)

===
Raymond Camden, ColdFusion Jedi Master for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, June 07, 2002 10:08 AM
 To: CF-Talk
 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
 
 -- 
 
 Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ |
 http://www.flashCFM.com/   - webRat (Moderator)|
 http://www.ultrashock.com/ - webRat (Back-end Moderator)   |
 
 
 
__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread Neil Clark - =TMM=

That long? :-p











Neil Clark
Team Macromedia
http://www.macromedia.com/go/team

Announcing Macromedia MX!! 
http://www.macromedia.com/software/trial/




-Original Message-
From: Raymond Camden [mailto:[EMAIL PROTECTED]] 
Sent: 07 June 2002 15:16
To: CF-Talk
Subject: RE: Opinion: CFC / Request scope question.

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. ;)

===
Raymond Camden, ColdFusion Jedi Master for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, June 07, 2002 10:08 AM
 To: CF-Talk
 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
 
 -- 
 
 Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ |
 http://www.flashCFM.com/   - webRat (Moderator)|
 http://www.ultrashock.com/ - webRat (Back-end Moderator)   |
 
 
 

__
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread todd

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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread Raymond Camden

Are you asking about pushing it into the request scope or putting it
into a variable in general? I don' think there is anything wrong with
either. Certainly if you want your custom tags to use the CFC it makes
since to put it in the request scope.

===
Raymond Camden, ColdFusion Jedi Master for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, June 07, 2002 10:19 AM
 To: CF-Talk
 Subject: RE: Opinion: CFC / Request scope question.
 
 
 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
 

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread todd

I'm asking about pushing it into the request scope more than anything. 
 Just checking to see if people cringe at the thought or not. =)

Thanks,
~Todd

On Fri, 7 Jun 2002, Raymond Camden wrote:

 Are you asking about pushing it into the request scope or putting it
 into a variable in general? I don' think there is anything wrong with
 either. Certainly if you want your custom tags to use the CFC it makes
 since to put it in the request scope.
 
 ===
 Raymond Camden, ColdFusion Jedi Master for Macromedia
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, June 07, 2002 10:19 AM
  To: CF-Talk
  Subject: RE: Opinion: CFC / Request scope question.
  
  
  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

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread Ben Johnson

 However, I'd still like to know peoples
 thoughts on pushing a component into the request scope.

I have not worked *too* much with CFCs, with the exception of with Flash
Remoting, but the idea of putting the CFCs in the request scope seems to be
a bit anti-OO to me.  I have always thought that you should pass references
or values to the CFC you are calling.  It doesn't seem very scalable to make
a CFC assume something is already created in the request scope or even that
the variable that is created is specifically named a certain way.



Ben Johnson
Hostworks, Inc.

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread Raymond Camden

I don't think that is what he is asking Ben. He is not talking about
making the CFC depend on request vars, rather, he is talking about
putting an instance of a CFC in the request scope. So he can do crap
like this:

application.cfm:
cfset request.logger = createObject(component,myKickButtLoggerCFC)

foo.cfm:
cfset request.logger.log(critical,App has broken)
sometag.cfm:
cfscript
stuff;
stuff;
more stuff;
request.logger.log(info,Added user bob);
/cfscript



===
Raymond Camden, ColdFusion Jedi Master for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: Ben Johnson [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, June 07, 2002 10:44 AM
 To: CF-Talk
 Subject: RE: Opinion: CFC / Request scope question.
 
 
  However, I'd still like to know peoples
  thoughts on pushing a component into the request scope.
 
 I have not worked *too* much with CFCs, with the exception of 
 with Flash
 Remoting, but the idea of putting the CFCs in the request 
 scope seems to be
 a bit anti-OO to me.  I have always thought that you should 
 pass references
 or values to the CFC you are calling.  It doesn't seem very 
 scalable to make
 a CFC assume something is already created in the request 
 scope or even that
 the variable that is created is specifically named a certain way.
 
 
 
 Ben Johnson
 Hostworks, Inc.
 
 
__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread Ben Johnson

 I don't think that is what he is asking Ben. He is not talking about
 making the CFC depend on request vars, rather, he is talking about
 putting an instance of a CFC in the request scope.

Sorry, I quoted the wrong section.  I can definitely understand using CFCs
in the request scope for that reason.  Here's what I mean to quote:


[EMAIL PROTECTED]:
 Now .. 'request.x' is available to even other cfcs without having to make
 an additional invoke/createObject call.




Ben Johnson
Hostworks, Inc.

__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread Raymond Camden

Ah, now THAT is a different matter. In general, I agree, it's a bad
idea. However, if you are building a framework where a set of CFCs work
together (in a package perhaps) then it may be safe. Spectra made heavy
use of stuff like this - and I think it made sense since everything was
so tightly wound together.

Another view on this - most of the custom tags I write that do DB stuff
will use #application.dsn# or #request.app.dsn# for the datasource.
Since the custom tag is _for_ the application, I don't feel bad about
this at all.

===
Raymond Camden, ColdFusion Jedi Master for Macromedia

Email: [EMAIL PROTECTED]
Yahoo IM : morpheus

My ally is the Force, and a powerful ally it is. - Yoda 

 -Original Message-
 From: Ben Johnson [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, June 07, 2002 11:01 AM
 To: CF-Talk
 Subject: RE: Opinion: CFC / Request scope question.
 
 
  I don't think that is what he is asking Ben. He is not talking about
  making the CFC depend on request vars, rather, he is talking about
  putting an instance of a CFC in the request scope.
 
 Sorry, I quoted the wrong section.  I can definitely 
 understand using CFCs
 in the request scope for that reason.  Here's what I mean to quote:
 
 
 [EMAIL PROTECTED]:
  Now .. 'request.x' is available to even other cfcs without 
 having to make
  an additional invoke/createObject call.
 
 
 
 
 Ben Johnson
 Hostworks, Inc.
 
 
__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Opinion: CFC / Request scope question.

2002-06-07 Thread todd

Which is what I do, but why would this be anti-OOP?  Are you sayiing to 
follow the true OOP standards, that in each CFC, I have to make a 
cffunction / or just  initialize those external objects I want to use?

~Todd

O Fri, 7 Jun 2002, Raymond Camden wrote:

 I don't think that is what he is asking Ben. He is not talking about
 making the CFC depend on request vars, rather, he is talking about
 putting an instance of a CFC in the request scope. So he can do crap
 like this:
 
 application.cfm:
 cfset request.logger = createObject(component,myKickButtLoggerCFC)
 
 foo.cfm:
 cfset request.logger.log(critical,App has broken)
 sometag.cfm:
 cfscript
 stuff;
 stuff;
 more stuff;
 request.logger.log(info,Added user bob);
 /cfscript
 
 
 
 ===
 Raymond Camden, ColdFusion Jedi Master for Macromedia
 
 Email: [EMAIL PROTECTED]
 Yahoo IM : morpheus
 
 My ally is the Force, and a powerful ally it is. - Yoda 
 
  -Original Message-
  From: Ben Johnson [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, June 07, 2002 10:44 AM
  To: CF-Talk
  Subject: RE: Opinion: CFC / Request scope question.
  
  
   However, I'd still like to know peoples
   thoughts on pushing a component into the request scope.
  
  I have not worked *too* much with CFCs, with the exception of 
  with Flash
  Remoting, but the idea of putting the CFCs in the request 
  scope seems to be
  a bit anti-OO to me.  I have always thought that you should 
  pass references
  or values to the CFC you are calling.  It doesn't seem very 
  scalable to make
  a CFC assume something is already created in the request 
  scope or even that
  the variable that is created is specifically named a certain way.
  
  
  
  Ben Johnson
  Hostworks, Inc.
  
  
 
__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists