Brian, that's the correct answer - thanks. Baz
-----Original Message----- From: Brian Kotek [mailto:[EMAIL PROTECTED] Sent: Sunday, January 08, 2006 10:08 PM To: CF-Talk Subject: Re: THIS or that If you used THIS, some other bit of code could do: <cfset OutsideCFC.InsideCFC = "" > and completely overwrite the CFC at any time with no warning. Using a getter method and a private instance variable prevents this. On 1/8/06, James Holmes <[EMAIL PROTECTED]> wrote: > > It's not quite the same, because if it's in the THIS scope it can be > modified (changed, deleted, generally messed up) by code outside the > CFC. Also, using a getter method makes it possible to do other things > before returning the object (e.g. security checks). > > On 1/9/06, Baz <[EMAIL PROTECTED]> wrote: > > Oops, forgot to change the subject before... > > > > If you have a CFC within another CFC you could save it as either: > > > > 1. variables.InsideCFC OR > > 2. this.InsideCFC > > > > I am fully aware the differences between the 2 scopes and I'm sure most > > people would say that it is better to save it in the variables scope. > > > > However I see a lot of people doing this: > > > > - OutsideCFC.getInsideCFC().PerformMethod() > > > > A method is defined in the OutsideCFC to return the entire InsideCFC > thereby > > exposing all its methods. Is that not the same thing as just having it > > directly accessible in the THIS scope? Not to mention that your calls > would > > look nicer: > > > > Nicer: OutsideCFC.InsideCFC.PerformMethod() > > Uglier: OutsideCFC.getInsideCFC().PerformMethod() > > -- > CFAJAX docs and other useful articles: > http://jr-holmes.coldfusionjournal.com/ > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228803 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54