Today's just not my day.  I emailed O'Reilly and asked them to update my
examples to show returntype="shoppingCart" instaid of returntype="struct".
Although both will work, returning the name of the CFC is a better choice
for several reasons.

Thanks,

Rob




Sean A Corfield <[EMAIL PROTECTED]>@cfczone.org on 09/25/2003 01:09:25 PM

Please respond to [EMAIL PROTECTED]

Sent by:    [EMAIL PROTECTED]



To:    [EMAIL PROTECTED]
cc:


Subject:    Re: [CFCDev] Top Ten Tips for Developing ColdFusion Components


On Thursday, Sep 25, 2003, at 12:52 US/Pacific, Hardy Jonck wrote:
> In the online article first point:
> <cfcomponent displayname="shoppingCart">
>   <cffunction name="init" access="public" output="no"
> returntype="struct">
>     <cfargument name="cartID" type="UUID" required="yes">
>    ...
> </cfcomponent>
> Should the returntype not rather be "shoppingCart" ie.

Yes, that would probably be better practice (I didn't notice that when
I first read the article!).

> Why would you store the cartID in the variables scope and not the this
> scope? If I understand correctly the variables scope only lives for the
> duration of the request/response event - but I seem to be wrong as the
> article states that the variables scope lives as long as the object
> does....

'var' scope only lives for the duration of the function invocation,
'variables' scope lives for the duration of the CFC instance itself and
hold non-public instance data, 'this' scope is, effectively, the public
equivalent of 'variables' scope.

> Is the variables scope a
> place to rather put all private attributes that you do not want
> accessible
> from other components?

Yup.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

 An archive of the CFCDev list is available at
 www.mail-archive.com/[EMAIL PROTECTED]




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to