cfc accessing session scope - bad?

2010-05-20 Thread Matthew P. Smith

Is it a bad practice to have a cfc access a session variable?  Should the
session variable be passed in as an argument instead?


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333834
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfc accessing session scope - bad?

2010-05-20 Thread Cutter (ColdFusion)

Best practice is to pass in the session variable. There can be issues 
with calling a persistent scope directly within a CFC, typically around 
application performance and proper garbage collection.

Steve Cutter Blades
Adobe Community Professional - ColdFusion
Adobe Certified Professional
Advanced Macromedia ColdFusion MX 7 Developer

Co-Author of Learning Ext JS
http://www.packtpub.com/learning-ext-js/book
_
http://blog.cutterscrossing.com



Matthew P. Smith wrote:
 Is it a bad practice to have a cfc access a session variable?  Should the
 session variable be passed in as an argument instead?


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333835
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfc accessing session scope - bad?

2010-05-20 Thread Brian Kotek

In general, yes. The exceptions are if you have a method specifically meant
to encapsulate access session scope so that other methods in the object can
get to that data (i.e. a getCurrentUser() method in a UserService), or if
you create a dedicated SessionProxy object that other objects use to access
data in the session scope.

On Thu, May 20, 2010 at 8:04 AM, Matthew P. Smith 
m...@smithwebdesign.netwrote:


 Is it a bad practice to have a cfc access a session variable?  Should the
 session variable be passed in as an argument instead?


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333836
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfc accessing session scope - bad?

2010-05-20 Thread Adrian Moreno

I've got an example of a Session Facade (or Session Proxy?) on my site:

http://www.iknowkungfoo.com/blog/index.cfm/2007/2/12/Using-a-Session-Facade-to-handle-evolving-session-variables

--- Adrian

In general, yes. The exceptions are if you have a method specifically meant
to encapsulate access session scope so that other methods in the object can
get to that data (i.e. a getCurrentUser() method in a UserService), or if
you create a dedicated SessionProxy object that other objects use to access
data in the session scope.

On Thu, May 20, 2010 at 8:04 AM, Matthew P. Smith 
m...@smithwebdesign.netwrote:


 Is it a bad practice to have a cfc access a session variable?  Should the
 session variable be passed in as an argument instead?


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333863
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfc accessing session scope - bad?

2010-05-20 Thread Eric Cobb

Me too!  Me too!  Me too!  :)

http://www.cfgears.com/index.cfm/2009/12/3/Using-a-Session-Facade-in-ColdFusion

I can vouch for Adrian's article, though.  When I first started working 
with Session Facades in Mach-II, the post he linked to below went a long 
way in helping me understand them.

Thanks,

Eric Cobb
ECAR Technologies, LLC
http://www.ecartech.com
http://www.cfgears.com



Adrian Moreno wrote:
 I've got an example of a Session Facade (or Session Proxy?) on my site:

 http://www.iknowkungfoo.com/blog/index.cfm/2007/2/12/Using-a-Session-Facade-to-handle-evolving-session-variables

 --- Adrian

   
 In general, yes. The exceptions are if you have a method specifically meant
 to encapsulate access session scope so that other methods in the object can
 get to that data (i.e. a getCurrentUser() method in a UserService), or if
 you create a dedicated SessionProxy object that other objects use to access
 data in the session scope.

 On Thu, May 20, 2010 at 8:04 AM, Matthew P. Smith 
 m...@smithwebdesign.netwrote:

 
 Is it a bad practice to have a cfc access a session variable?  Should the
 session variable be passed in as an argument instead?



   

 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333864
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm