Re: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-14 Thread Muzak
pective). regards, Muzak - Original Message - From: "Matthias Dittgen" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Wednesday, February 14, 2007 8:54 AM Subject: Re: [Flashcoders] Coding Standards: Use of Get/Set > You always compare "impli

Re: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-13 Thread Matthias Dittgen
You always compare "implicit getter/settter" with "explicit getter/setter". Just a thought of mine is to compare "implicit getter/setter" with public variables. When you use someClass, that was written by someone else, you do not know if the following code uses "implicit getter/setter" or is just

Re: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-13 Thread T. Michael Keesey
One of the few reasons to use explicit getters/setters in AS2 is as part of an interface. AS2 does not allow implicit property getters and setters in interfaces. // Will not work in AS2: interface Ratio { function get percent():Number; } // Will work in AS2: interface Ratio { function getPer

Re: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-13 Thread Muzak
I use implicit getter/setters all the time when it involves a single property of an object: width, height, visible, etc.. I use explicit getter/setters when one or more parameters are required: getItemAt(index), setSize(w, h) Implict getter/setters are also invoked before the constructor, which

Re: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-13 Thread T. Michael Keesey
Just thought of another use for properties: component parameters. With properties you can do something like this: [Inspectable] public function get percent():Number { return _percent; } public function set percent(value:Number):Void { _percent = normalizePercentage(value); } private var _perc

RE: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-13 Thread Steven Sacks | BLITZ
Get/set is useful when creating a visual object class, as well as for setting private variables on set. It's also useful when you don't want the variable that is being set to be getted, as well. For instance, I have an application which allows a user to type in the day, month and year into three

Re: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-13 Thread T. Michael Keesey
On 2/13/07, Holth, Daniel C. <[EMAIL PROTECTED]> wrote: I was wondering what people's thoughts were on the use of "get" and "set" functions. I personally have felt that creating functions such as: public function get theLetterA(){ return "a"; } so the user can simply call someObject.t

Re: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-13 Thread Daniel Grace
The biggest complaint that I have seen is the issue of speed. If you do "var foo: String = obj.theLetterA" you expect that to be a hash lookup/dereference/something fast. If you do "var foo: String = obj.getSomething()" and you are thinking about speed, you go and look at what getSomething() is doi

RE: [Flashcoders] Coding Standards: Use of Get/Set

2007-02-13 Thread Pete Miller
Just to fuel your query, how does it affect the user to know whether they are 'get'-ing from a variable or a function call, encapsulation considered? P. >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:flashcoders- >> [EMAIL PROTECTED] On Behalf Of Holth, Daniel C. >> Sent: Tuesda