Sometimes it's appropriate, sure.  That is a lot of overhead, though, 
ecspecially for setters.

size = 2 does:
- setter runs
- getter runs for setter
- getter runs getSize function
- getSize function gets value, returns it
- getter returns value for setter
- setter changes value

...that's a lot to add to the stack just to set a number.  However, in some 
cases, this is a great setup since the inner workings are hidden, and you 
have flexibility in how you expose properties.

----- Original Message ----- 
From: "Iv" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Wednesday, February 08, 2006 7:38 PM
Subject: Re[2]: [Flashcoders] Q:getter setters vs accessor methods


Hello JesterXL,

how about both?

public function get _size():Number{
       return this.getSize()
}
private function getSize():Number{}


J> getSize/setSize because setSize can return a value when setting a 
property
J> whereas a getter/setter cannot.

J> However, getter/setters are perfect for binding in Flex whereas you 
cannot
J> bind to methods.  Additionally, getter/setters make it easier to refactor 
a
J> property later on in development when everyone sets it.  This way, you 
can
J> still trigger stuff without changing all of the other classes that have
J> already used it.


-- 
Ivan Dembicki
____________________________________________________________________________
[EMAIL PROTECTED] |                                        | 
http://www.design.ru

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to