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 doing. This makes sense to me, while the other
arguments I've heard against get/set make no sense to me.
For the record though I've never used get/set functions because I don't
see the point in making the syntax stranger compared to the other
languages I've used which either don't have or didn't provide me a good
reason to use get/set. Can someone tell me any benefit at all?
Daniel
Pete Miller wrote:
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: Tuesday, February 13, 2007 3:32 PM
To: Flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Coding Standards: Use of Get/Set
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.theLetterA are confusing
because
the user doesn't know if they are doing a function call or accessing
a
public variable. I prefer writing functions such as:
public function getTheLetterA(){
return a;
}
So the user needs to explicitly call the function
someObject.getTheLetterA().
Are there advantages to using get and set that I'm not seeing?
I ask because I was always use getVariable() functions and started
reading ActionScript 3 with Design Patterns and the authors (as well
as
many others I've read) are using get and set functions.
Daniel Holth
I.S. Programmer
This e-mail and its attachments are intended only for the use of the
addressee(s) and may contain privileged, confidential or proprietary
information. If you are not the intended recipient, or the employee
or
agent responsible for delivering the message to the intended
recipient,
you are hereby notified that any dissemination, distribution,
displaying,
copying, or use of this information is strictly prohibited. If you
have
received this communication in error, please inform the sender
immediately and delete and destroy any record of this message. Thank
you.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com