Thanks for clearing that up for me.
As far as the this scope goes though, to be honest, writing set and
get methods is a pita even though I know it's a good habit.

Just thinking out loud here...but a keyboard shortcut that prompt's
for the variable name and write's out the set and get methods would be
quite handy. Maybe something for that mythical code oriented Homesite
followup if it ever comes into being.

-- 
mailto:[EMAIL PROTECTED]
Saturday, March 15, 2003, 8:24:45 PM, you wrote:

SAC> This looks like the work of either Mike Nimer or Ray Camden... One of 
SAC> them, I can't remember which, is very fond of the 
SAC> cfparam-to-initialize-this-attributes idiom.

SAC> I personally don't like it(!) because, to me, cfparam says "I'm being 
SAC> passed some parameters and I'll validate their types and set defaults 
SAC> for omitted ones" whereas for 'this.' attributes, you clearly are not 
SAC> being passed any parameters and, as you correctly observe, none of them 
SAC> will exist. I'd just use cfset instead.

SAC> I'd also be suspicious of using 'this.' since it's publicly accessible 
SAC> (and I don't think I'd want client code to be able to modify userid!).

SAC> On Saturday, Mar 15, 2003, at 15:17 US/Pacific, [EMAIL PROTECTED] 
SAC> wrote:

>> I've been digging into the Pet Market this weekend, and I'm hoping
>> if anyone can shed some light on the reasoning behind the way they
>> chose to initialize the cfc's. Specifically the user.cfc which is
>> instantiated in the application.cfm, has constructor code that looks
>> like this.
>>
>> <cfparam name="this.userid" default="#createuuid()#">
>> <cfparam name="this.familyname" default="">
>> <cfparam name="this.givenname" default="">
>> <cfparam name="this.phone1" default="">
>> <cfparam name="this.email" default="">
>> etc...
>>
>> My question is why use cfparam if the constructor code is only going
>> to be run when the cfc is first instantiated? None of the properties
>> are going to exist yet anyway... What am I missing here?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to