Typically _ was used with same names, so:

_selectedIndex could be the private, and the getter:

public function get selectedIndex

To me, publics should just be normal vanilla, and the class should handle 
those details, consitently.

For more info:

http://www.macromedia.com/devnet/mx/flash/articles/as_bestpractices.html




----- Original Message ----- 
From: "Manish Jethani" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Monday, May 16, 2005 1:39 PM
Subject: Re: [flexcoders] Development of components with AS


On 5/16/05, dave buhler <[EMAIL PROTECTED]> wrote:
>  What's common usage for variables with underscores in a class 
> architecture?
>
>  __variable vs _variable vs variable?

I hope I'm getting this right... somebody correct me if I'm wrong:

 1.  Double underscore for private variables holding values for public
properties.  For example selectedIndex is internally stored in
__selectedIndex and then wrapped into a getter-setter pair.
 2.  Single underscore for other private variables.
 3.  No underscore for public variables (although if a variable does
not have an underscore it's not necessarily public, so there's some
inconsistency here).

I haven't seen any document on these conventions (but that's most
probably my fault).  Also things are likely to change in the future,
so I wouldn't rely on these naming conventions for my own classes.

Personally, I think only #1 above really makes sense (i.e. I don't see
why _measuredPreferredWidth couldn't be just measuredPreferredWidth).



Yahoo! Groups Links







 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to