T. Michael Keesey wrote:
On 8/22/07, Alan MacDougall <[EMAIL PROTECTED]> wrote:
Further derail! What are people's thoughts on implicit vs. explicit
accessors? I prefer explicit ones, but I confess that it's almost
entirely because I learned Java before Actionscript.

I think a lot of it has to do with readability. Compare:

clipA.setWidth(clipB.getWidth() + clipC.getX());

clipA.width = clipB.width + clipC.x;

And another point: Suppose you start out making something as a public
field and then later realize you need to restrict its value in some
way. With properties, this change will make absolutely no difference
to the rest of your code. Without properties, you will have to change
every instance of "obj.myField = x" to "obj.setMyField(x)" and every
other instance of "obj.myField" to "obj.getMyField()". So it makes
this type of refactoring far easier.
You start with every property private and you never have to refactor the rest of your code (encapsulation) That is the tradeoff between readibility and less typing against robustness and predictable refactoring.

Personally I find properties (i.e., implicit getters and setters) to
be one of ActionScript's few advantages over Java as a language. (Now
if only we could have abstract classes, exception types in function
signatures, etc....)
I am not sure if this helps but it makes interesting reading.
http://nodename.com/blog/2005/09/19/abstract-classes/
_______________________________________________
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

Reply via email to