Re: [Flashcoders] use get / set functions or make your own
Keyword: Old. Hans Wichman wrote: ps we're probably not the first ones discussing this old subject, has n1 found some good sources/references? Most of the old CS textbooks sentence you to hell for using public variables so let's not refer to those ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
And just to clarify: Stand on the shoulders of giants, don't follow in their footsteps. Steven Sacks wrote: Keyword: Old. Hans Wichman wrote: ps we're probably not the first ones discussing this old subject, has n1 found some good sources/references? Most of the old CS textbooks sentence you to hell for using public variables so let's not refer to those ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
On Wed, Dec 10, 2008 at 4:01 AM, Steven Sacks [EMAIL PROTECTED] wrote: That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. People who do this private var _foo:Boolean; public function get foo():Boolean { return _foo; } public function set foo(value:Boolean):void { _foo = value; } are masturbating and I'm not impressed by their bloated ego...I mean code. ;) It is incredibly rare that I agree with Steven. :-) I do on this one, as I said earlier - although I might not have expressed it like that. That pattern - as above - which wraps a private property up as a couple of methods is exactly what happens with explicit setters/getters (getVar(), setVar()) _all the time_ in Java simply in self defense, because changing from a public property to a getter/setter breaks the API of your class (and so you need to rewrite all the classes using it). Which is why in this instance AS is head-and-shoulders over Java. Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
In the programming languages used in the old CS textbooks, you didn't have the option to switch from a public property to a getter/setter pair without breaking the interface. Ian On Wed, Dec 10, 2008 at 8:23 AM, Steven Sacks [EMAIL PROTECTED] wrote: Keyword: Old. Hans Wichman wrote: ps we're probably not the first ones discussing this old subject, has n1 found some good sources/references? Most of the old CS textbooks sentence you to hell for using public variables so let's not refer to those ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
Thankfully, AS3 allows you to put implicit getters and setters into an interface. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
For some vars, the bounds don't matter - so why not use a public? If they do matter, use getters/setters. The beauty of Actionscript is - to the designer - it doesn't matter or change anything. :-) And from your PoV, you can flip between either when you need to add (or drop) bounds checks. (Or traces, or whatever.) :-) Ian On Wed, Dec 10, 2008 at 11:15 AM, Eric E. Dolecki [EMAIL PROTECTED] wrote: I usually take the private with getters and setters approach - I can check the bounds of the setting of the var. I am thinking more of designers here taking the code and using it than I am other developers. Although I have many times set up public vars that I tweak from outside the class(es) too. Eric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
any code amending outside the class can be avoided if you take the (self-imposed) rule that internal/private class vars start with a leading underscore but public ones don't - that way if you need to create getters and setters, you just create the class var with the _ and the get/set without On Wed, Dec 10, 2008 at 9:43 AM, Ian Thomas [EMAIL PROTECTED] wrote: In the programming languages used in the old CS textbooks, you didn't have the option to switch from a public property to a getter/setter pair without breaking the interface. Ian On Wed, Dec 10, 2008 at 8:23 AM, Steven Sacks [EMAIL PROTECTED] wrote: Keyword: Old. Hans Wichman wrote: ps we're probably not the first ones discussing this old subject, has n1 found some good sources/references? Most of the old CS textbooks sentence you to hell for using public variables so let's not refer to those ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
It is incredibly rare that I agree with Steven. I resemble that remark! ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
I usually take the private with getters and setters approach - I can check the bounds of the setting of the var. I am thinking more of designers here taking the code and using it than I am other developers. Although I have many times set up public vars that I tweak from outside the class(es) too. Eric On Wed, Dec 10, 2008 at 5:14 AM, Ian Thomas [EMAIL PROTECTED] wrote: I think we're saying the same thing there. :-) Such code amending is needed in languages like Java, because you can't go from a property to a getter/setter _without_ changing the interface. Which is why the Java getters and setters are used almost everywhere - like I said, it's programming in self-defense. Ian On Wed, Dec 10, 2008 at 10:05 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: any code amending outside the class can be avoided if you take the (self-imposed) rule that internal/private class vars start with a leading underscore but public ones don't - that way if you need to create getters and setters, you just create the class var with the _ and the get/set without On Wed, Dec 10, 2008 at 9:43 AM, Ian Thomas [EMAIL PROTECTED] wrote: In the programming languages used in the old CS textbooks, you didn't have the option to switch from a public property to a getter/setter pair without breaking the interface. Ian On Wed, Dec 10, 2008 at 8:23 AM, Steven Sacks [EMAIL PROTECTED] wrote: Keyword: Old. Hans Wichman wrote: ps we're probably not the first ones discussing this old subject, has n1 found some good sources/references? Most of the old CS textbooks sentence you to hell for using public variables so let's not refer to those ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
I think we're saying the same thing there. :-) Such code amending is needed in languages like Java, because you can't go from a property to a getter/setter _without_ changing the interface. Which is why the Java getters and setters are used almost everywhere - like I said, it's programming in self-defense. Ian On Wed, Dec 10, 2008 at 10:05 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: any code amending outside the class can be avoided if you take the (self-imposed) rule that internal/private class vars start with a leading underscore but public ones don't - that way if you need to create getters and setters, you just create the class var with the _ and the get/set without On Wed, Dec 10, 2008 at 9:43 AM, Ian Thomas [EMAIL PROTECTED] wrote: In the programming languages used in the old CS textbooks, you didn't have the option to switch from a public property to a getter/setter pair without breaking the interface. Ian On Wed, Dec 10, 2008 at 8:23 AM, Steven Sacks [EMAIL PROTECTED] wrote: Keyword: Old. Hans Wichman wrote: ps we're probably not the first ones discussing this old subject, has n1 found some good sources/references? Most of the old CS textbooks sentence you to hell for using public variables so let's not refer to those ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] use get / set functions or make your own
I tend to send this link on whenever this debate comes up, good article on public vars vs. getters and setters from a well respected Actionscript coder. http://www.darronschall.com/weblog/2005/03/no-brain-getter-and-setters.cfm And I also agree with Steve, Ian, the others, I used to be against public vars, but now I see when they don't need to have a brain i.e logic is run when they are called, and it's ok to allow them as a pair (i.e. both get and set), then there is no reason to not use public vars since from an interface perspective, they are exactly the same. And if you ever need the brain inserted into getting or setting, it's extremely simple to add them afterwards. Just writing out get and set for everything just bloats your code. There is a place for both. I code public vars all the time now, probably more than get/set pairs. Jason Merrill Bank of America Instructional Technology Media · GCIB Staff Support LLD Interested in Flash Platform technologies? Join the Bank of America Flash Platform Developer Community Interested in innovative ideas in Learning? Check out the Innovative Learning Blog and subscribe. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
Hi, yep that was the article, but the original poster asked a subtly different question (unless I'm mistaken). allandt asked about implicit vs explicit getters setters. Darron talks about using public variables vs implicit no brain getters setters. First time I read that article I thought he was talking about implicit vs explicit, to which my conclusion was: this article sucks. Rereading it and seeing its about public variables vs implicit, it's a nice read ;). But another discussion:). greetz JC On Wed, Dec 10, 2008 at 3:42 PM, Merrill, Jason [EMAIL PROTECTED] wrote: I tend to send this link on whenever this debate comes up, good article on public vars vs. getters and setters from a well respected Actionscript coder. http://www.darronschall.com/weblog/2005/03/no-brain-getter-and-setters.cfm And I also agree with Steve, Ian, the others, I used to be against public vars, but now I see when they don't need to have a brain i.e logic is run when they are called, and it's ok to allow them as a pair (i.e. both get and set), then there is no reason to not use public vars since from an interface perspective, they are exactly the same. And if you ever need the brain inserted into getting or setting, it's extremely simple to add them afterwards. Just writing out get and set for everything just bloats your code. There is a place for both. I code public vars all the time now, probably more than get/set pairs. Jason Merrill Bank of America Instructional Technology Media · GCIB Staff Support LLD Interested in Flash Platform technologies? Join the Bank of America Flash Platform Developer Community Interested in innovative ideas in Learning? Check out the Innovative Learning Blog and subscribe. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] use get / set functions or make your own
yep that was the article, but the original poster asked a subtly different question (unless I'm mistaken). allandt asked about implicit vs explicit getters setters. Rereading it and seeing its about public variables vs implicit, it's a nice read ;). But another discussion:). Uh, I guess you didn't notice, I was not responding to the original poster - we have deviated from that. i.e. Ian's comment, so why not use a public? If they do matter, use getters/setters. Jason Merrill Bank of America Instructional Technology Media · GCIB Staff Support LLD Interested in Flash Platform technologies? Join the Bank of America Flash Platform Developer Community Interested in innovative ideas in Learning? Check out the Innovative Learning Blog and subscribe. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
hmmm no guess I didn't, been pixelstaring too long already today;) On Wed, Dec 10, 2008 at 4:18 PM, Merrill, Jason [EMAIL PROTECTED] wrote: yep that was the article, but the original poster asked a subtly different question (unless I'm mistaken). allandt asked about implicit vs explicit getters setters. Rereading it and seeing its about public variables vs implicit, it's a nice read ;). But another discussion:). Uh, I guess you didn't notice, I was not responding to the original poster - we have deviated from that. i.e. Ian's comment, so why not use a public? If they do matter, use getters/setters. Jason Merrill Bank of America Instructional Technology Media · GCIB Staff Support LLD Interested in Flash Platform technologies? Join the Bank of America Flash Platform Developer Community Interested in innovative ideas in Learning? Check out the Innovative Learning Blog and subscribe. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
I apologise for being deviant. Oh, hang on... :-P Ian On Wed, Dec 10, 2008 at 3:40 PM, Hans Wichman [EMAIL PROTECTED] wrote: hmmm no guess I didn't, been pixelstaring too long already today;) On Wed, Dec 10, 2008 at 4:18 PM, Merrill, Jason [EMAIL PROTECTED] wrote: yep that was the article, but the original poster asked a subtly different question (unless I'm mistaken). allandt asked about implicit vs explicit getters setters. Rereading it and seeing its about public variables vs implicit, it's a nice read ;). But another discussion:). Uh, I guess you didn't notice, I was not responding to the original poster - we have deviated from that. i.e. Ian's comment, so why not use a public? If they do matter, use getters/setters. Jason Merrill Bank of America Instructional Technology Media · GCIB Staff Support LLD Interested in Flash Platform technologies? Join the Bank of America Flash Platform Developer Community Interested in innovative ideas in Learning? Check out the Innovative Learning Blog and subscribe. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
good roundup - thanks ^^ On Wed, Dec 10, 2008 at 5:31 PM, Joel Stransky [EMAIL PROTECTED]wrote: So lets see if I can sum up the consensus here. There are four techniques for accessors and mutators listed (imho) in order of suggested use. 1. *public vars * - probably the best place to start - easily changed to implicit by changing to private with underscore. * * 2. *brainless implicit * - In case you want a read only property. (get but not set)* * 3. *implicit with brain* - when complex logic is needed for the return such as get date returning month + / + day + / + year. - to prevent invalid data 4. *explicit for lookup (myObject.addChildAt()) * - when multiple parameters are needed - when a return value may not be needed There's probably better points for #4 but I can't think of them as it's basically an argument for just writing a public method. On Wed, Dec 10, 2008 at 11:18 AM, Ian Thomas [EMAIL PROTECTED] wrote: I apologise for being deviant. Oh, hang on... :-P Ian On Wed, Dec 10, 2008 at 3:40 PM, Hans Wichman [EMAIL PROTECTED] wrote: hmmm no guess I didn't, been pixelstaring too long already today;) On Wed, Dec 10, 2008 at 4:18 PM, Merrill, Jason [EMAIL PROTECTED] wrote: yep that was the article, but the original poster asked a subtly different question (unless I'm mistaken). allandt asked about implicit vs explicit getters setters. Rereading it and seeing its about public variables vs implicit, it's a nice read ;). But another discussion:). Uh, I guess you didn't notice, I was not responding to the original poster - we have deviated from that. i.e. Ian's comment, so why not use a public? If they do matter, use getters/setters. Jason Merrill Bank of America Instructional Technology Media · GCIB Staff Support LLD Interested in Flash Platform technologies? Join the Bank of America Flash Platform Developer Community Interested in innovative ideas in Learning? Check out the Innovative Learning Blog and subscribe. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] use get / set functions or make your own
I missed the first part of this thread but I'd like to add that when you create an interface for a class, all your public properties should be getters and setters. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of allandt bik-elliott (thefieldcomic.com) Sent: Wednesday, December 10, 2008 10:33 AM To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own good roundup - thanks ^^ On Wed, Dec 10, 2008 at 5:31 PM, Joel Stransky [EMAIL PROTECTED]wrote: So lets see if I can sum up the consensus here. There are four techniques for accessors and mutators listed (imho) in order of suggested use. 1. *public vars * - probably the best place to start - easily changed to implicit by changing to private with underscore. * * 2. *brainless implicit * - In case you want a read only property. (get but not set)* * 3. *implicit with brain* - when complex logic is needed for the return such as get date returning month + / + day + / + year. - to prevent invalid data 4. *explicit for lookup (myObject.addChildAt()) * - when multiple parameters are needed - when a return value may not be needed There's probably better points for #4 but I can't think of them as it's basically an argument for just writing a public method. On Wed, Dec 10, 2008 at 11:18 AM, Ian Thomas [EMAIL PROTECTED] wrote: I apologise for being deviant. Oh, hang on... :-P Ian On Wed, Dec 10, 2008 at 3:40 PM, Hans Wichman [EMAIL PROTECTED] wrote: hmmm no guess I didn't, been pixelstaring too long already today;) On Wed, Dec 10, 2008 at 4:18 PM, Merrill, Jason [EMAIL PROTECTED] wrote: yep that was the article, but the original poster asked a subtly different question (unless I'm mistaken). allandt asked about implicit vs explicit getters setters. Rereading it and seeing its about public variables vs implicit, it's a nice read ;). But another discussion:). Uh, I guess you didn't notice, I was not responding to the original poster - we have deviated from that. i.e. Ian's comment, so why not use a public? If they do matter, use getters/setters. Jason Merrill Bank of America Instructional Technology Media * GCIB Staff Support LLD Interested in Flash Platform technologies? Join the Bank of America Flash Platform Developer Community Interested in innovative ideas in Learning? Check out the Innovative Learning Blog and subscribe. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
i would have to agree - i use the built in ones and can't see any benefit from using bespoke ones apart from maybe being able to use the variable name i want rather than adding extra characters to it (although i use a leading underscore for class variables anyway) On Tue, Dec 9, 2008 at 10:48 AM, Ian Thomas [EMAIL PROTECTED] wrote: I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
I think some ActionScript developers simply prefer the use of regular setVar() getVar() instance methods instead of the AS3 get set keywords because they know what's going on in their own code. I remember going to Colin Moock's AS3 1 day crash course last year in Toronto and he said that while there was nothing wrong with either method, he preferred regular getVar() setVar() instance methods because he felt more in control over his own code. With AS3 get set keywords, AS probably does a bunch of things in the back that you're not aware of to make it work as expected. This is probably the same kind of debate as the tabs vs spaces debate. Both ways are OK, simply stick with the one you prefer... --- On Tue, 12/9/08, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: From: allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] Subject: Re: [Flashcoders] use get / set functions or make your own To: Flash Coders List flashcoders@chattyfig.figleaf.com Date: Tuesday, December 9, 2008, 6:28 AM i would have to agree - i use the built in ones and can't see any benefit from using bespoke ones apart from maybe being able to use the variable name i want rather than adding extra characters to it (although i use a leading underscore for class variables anyway) On Tue, Dec 9, 2008 at 10:48 AM, Ian Thomas [EMAIL PROTECTED] wrote: I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
Hi, I'm still in the middle. I used to use getMyVariable setMyVariable for everything, now I usually use public variables for entity/value objects. I still hate not being able to see whether something is a variable or function, so for everything else than very simple objects I prefer setMyVariable getMyVariable instead of get set. I find it way easier to read back my code that way, so it depends on whether I know whether I am going to have to read it back or not ;). greetz JC On Tue, Dec 9, 2008 at 12:28 PM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: i would have to agree - i use the built in ones and can't see any benefit from using bespoke ones apart from maybe being able to use the variable name i want rather than adding extra characters to it (although i use a leading underscore for class variables anyway) On Tue, Dec 9, 2008 at 10:48 AM, Ian Thomas [EMAIL PROTECTED] wrote: I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
Since I like FlashDevelop, with a keyboard shortcut and a click I create setters and getters. On Tue, Dec 9, 2008 at 9:02 AM, Hans Wichman [EMAIL PROTECTED] wrote: Hi, I'm still in the middle. I used to use getMyVariable setMyVariable for everything, now I usually use public variables for entity/value objects. I still hate not being able to see whether something is a variable or function, so for everything else than very simple objects I prefer setMyVariable getMyVariable instead of get set. I find it way easier to read back my code that way, so it depends on whether I know whether I am going to have to read it back or not ;). greetz JC On Tue, Dec 9, 2008 at 12:28 PM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: i would have to agree - i use the built in ones and can't see any benefit from using bespoke ones apart from maybe being able to use the variable name i want rather than adding extra characters to it (although i use a leading underscore for class variables anyway) On Tue, Dec 9, 2008 at 10:48 AM, Ian Thomas [EMAIL PROTECTED] wrote: I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] use get / set functions or make your own
Yes I prefer FD also, but what is the shortcut for getters and setters?? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric E. Dolecki Sent: dinsdag 9 december 2008 15:16 To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own Since I like FlashDevelop, with a keyboard shortcut and a click I create setters and getters. On Tue, Dec 9, 2008 at 9:02 AM, Hans Wichman [EMAIL PROTECTED] wrote: Hi, I'm still in the middle. I used to use getMyVariable setMyVariable for everything, now I usually use public variables for entity/value objects. I still hate not being able to see whether something is a variable or function, so for everything else than very simple objects I prefer setMyVariable getMyVariable instead of get set. I find it way easier to read back my code that way, so it depends on whether I know whether I am going to have to read it back or not ;). greetz JC On Tue, Dec 9, 2008 at 12:28 PM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: i would have to agree - i use the built in ones and can't see any benefit from using bespoke ones apart from maybe being able to use the variable name i want rather than adding extra characters to it (although i use a leading underscore for class variables anyway) On Tue, Dec 9, 2008 at 10:48 AM, Ian Thomas [EMAIL PROTECTED] wrote: I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.15/1839 - Release Date: 9-12-2008 9:59 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
select the variable, ctrl-shift-1 ;) On Tue, Dec 9, 2008 at 9:26 AM, Cor [EMAIL PROTECTED] wrote: Yes I prefer FD also, but what is the shortcut for getters and setters?? -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Eric E. Dolecki Sent: dinsdag 9 december 2008 15:16 To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own Since I like FlashDevelop, with a keyboard shortcut and a click I create setters and getters. On Tue, Dec 9, 2008 at 9:02 AM, Hans Wichman [EMAIL PROTECTED] wrote: Hi, I'm still in the middle. I used to use getMyVariable setMyVariable for everything, now I usually use public variables for entity/value objects. I still hate not being able to see whether something is a variable or function, so for everything else than very simple objects I prefer setMyVariable getMyVariable instead of get set. I find it way easier to read back my code that way, so it depends on whether I know whether I am going to have to read it back or not ;). greetz JC On Tue, Dec 9, 2008 at 12:28 PM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: i would have to agree - i use the built in ones and can't see any benefit from using bespoke ones apart from maybe being able to use the variable name i want rather than adding extra characters to it (although i use a leading underscore for class variables anyway) On Tue, Dec 9, 2008 at 10:48 AM, Ian Thomas [EMAIL PROTECTED] wrote: I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.15/1839 - Release Date: 9-12-2008 9:59 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
The magic Context code completion hotkey, which by default is Ctrl-Shift-1, when your cursor is over a variable declaration. This awesome hotkey also does cool stuff like generates an event handler when your cursor is inside an addEventListener declaration... definitely check it out in the FD docs! On Tue, Dec 9, 2008 at 3:26 PM, Cor [EMAIL PROTECTED] wrote: Yes I prefer FD also, but what is the shortcut for getters and setters?? -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Eric E. Dolecki Sent: dinsdag 9 december 2008 15:16 To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own Since I like FlashDevelop, with a keyboard shortcut and a click I create setters and getters. On Tue, Dec 9, 2008 at 9:02 AM, Hans Wichman [EMAIL PROTECTED] wrote: Hi, I'm still in the middle. I used to use getMyVariable setMyVariable for everything, now I usually use public variables for entity/value objects. I still hate not being able to see whether something is a variable or function, so for everything else than very simple objects I prefer setMyVariable getMyVariable instead of get set. I find it way easier to read back my code that way, so it depends on whether I know whether I am going to have to read it back or not ;). greetz JC On Tue, Dec 9, 2008 at 12:28 PM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: i would have to agree - i use the built in ones and can't see any benefit from using bespoke ones apart from maybe being able to use the variable name i want rather than adding extra characters to it (although i use a leading underscore for class variables anyway) On Tue, Dec 9, 2008 at 10:48 AM, Ian Thomas [EMAIL PROTECTED] wrote: I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.15/1839 - Release Date: 9-12-2008 9:59 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] use get / set functions or make your own
Oh, I use that one to create functions and yes a getter/setter is also a function. My bad.. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric E. Dolecki Sent: dinsdag 9 december 2008 15:37 To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own select the variable, ctrl-shift-1 ;) On Tue, Dec 9, 2008 at 9:26 AM, Cor [EMAIL PROTECTED] wrote: Yes I prefer FD also, but what is the shortcut for getters and setters?? -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Eric E. Dolecki Sent: dinsdag 9 december 2008 15:16 To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own Since I like FlashDevelop, with a keyboard shortcut and a click I create setters and getters. On Tue, Dec 9, 2008 at 9:02 AM, Hans Wichman [EMAIL PROTECTED] wrote: Hi, I'm still in the middle. I used to use getMyVariable setMyVariable for everything, now I usually use public variables for entity/value objects. I still hate not being able to see whether something is a variable or function, so for everything else than very simple objects I prefer setMyVariable getMyVariable instead of get set. I find it way easier to read back my code that way, so it depends on whether I know whether I am going to have to read it back or not ;). greetz JC On Tue, Dec 9, 2008 at 12:28 PM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: i would have to agree - i use the built in ones and can't see any benefit from using bespoke ones apart from maybe being able to use the variable name i want rather than adding extra characters to it (although i use a leading underscore for class variables anyway) On Tue, Dec 9, 2008 at 10:48 AM, Ian Thomas [EMAIL PROTECTED] wrote: I use Actionscript getters and setters. Because I can start off using ordinary public properties, and change them into getters and setters if I need more control/notification without changing any of the code that _uses_ my class. In order to achieve that otherwise, I'd have to make a getValue() and setValue() for every single public property (as is done in Java). And a fair few of those would simply be this._property=value (setter) or return this._property (getter) i.e. essentially just placeholder methods that bloat the code. The beauty of the actionscript get and set functions is that they are indistinguishable from public properties from the outside of the class. It's a huge improvement over Java. Ian On Tue, Dec 9, 2008 at 10:24 AM, allandt bik-elliott (thefieldcomic.com) [EMAIL PROTECTED] wrote: hi guys quick poll - Do you use the actionscript getter/setter functions or do you make your own, and why. I've noticed with a lot of the public domain code (like SWFAddress, for instance) that you see a lot of 'public function getVariable()' type getters instead of using the flash 'public function get variable()' adobe recommended getters(and setters) and i was wondering why people do this? thanks a ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.15/1839 - Release Date: 9-12-2008 9:59 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.15/1839 - Release Date: 9-12-2008 9:59
Re: [Flashcoders] use get / set functions or make your own
Ooh - never knew about that. :-) You learn something every day! Ian On Tue, Dec 9, 2008 at 2:40 PM, jonathan howe [EMAIL PROTECTED] wrote: The magic Context code completion hotkey, which by default is Ctrl-Shift-1, when your cursor is over a variable declaration. This awesome hotkey also does cool stuff like generates an event handler when your cursor is inside an addEventListener declaration... definitely check it out in the FD docs! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] use get / set functions or make your own
When you open the Startpage of FD you find some more shortcuts. HTH Cor -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: dinsdag 9 december 2008 16:14 To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own Ooh - never knew about that. :-) You learn something every day! Ian On Tue, Dec 9, 2008 at 2:40 PM, jonathan howe [EMAIL PROTECTED] wrote: The magic Context code completion hotkey, which by default is Ctrl-Shift-1, when your cursor is over a variable declaration. This awesome hotkey also does cool stuff like generates an event handler when your cursor is inside an addEventListener declaration... definitely check it out in the FD docs! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.15/1839 - Release Date: 9-12-2008 9:59 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
Wow I didn't know that about FD. Gonna have to start using it. I still find myself wanting to use Flex Dev but that's another thread. It's nice to see discussions like this. I feel like some things are foregone conclusions and that I'm late to the part but hey, even Grant Skinner is blogging about cuddling braceshttp://www.gskinner.com/blog/archives/2008/11/curly_braces_to.html. For me, it depends on the complexity of the logic involved in calculating the return. If I'm dealing with a sensible property such as the left boundary for a group of display children, conditionals tend to read cleaner when I can just write: if(this.mouseX grid.left) rather than if(this.mouseX grid.getLeft()). If the property requires more complex code in order to return a value such as looping over an array, I use getVal(). getters and setters also have certain syntax requirements so I also avoid using them whenever I need to do something slightly different such as use multiple parameters. On Tue, Dec 9, 2008 at 10:18 AM, Cor [EMAIL PROTECTED] wrote: When you open the Startpage of FD you find some more shortcuts. HTH Cor -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: dinsdag 9 december 2008 16:14 To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own Ooh - never knew about that. :-) You learn something every day! Ian On Tue, Dec 9, 2008 at 2:40 PM, jonathan howe [EMAIL PROTECTED] wrote: The magic Context code completion hotkey, which by default is Ctrl-Shift-1, when your cursor is over a variable declaration. This awesome hotkey also does cool stuff like generates an event handler when your cursor is inside an addEventListener declaration... definitely check it out in the FD docs! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.15/1839 - Release Date: 9-12-2008 9:59 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
I think the Control-Shift-1 functionality is fairly new -- I only got it working after I upgraded FD to Beta 9. But yes, it rocks. You can also use it on your implements Interface text to generate placeholder functions for everything in that interface. Try it! Personally, I tend to use getters and setters only when I'm making a class that primarily functions like a Perl hash (or a Python dictionary or whatever the kids are using these days). If I use it to much with other classes, I start to worry that I've created public variables when I shouldn't have, and it constantly distracts me. --T On Tue, Dec 9, 2008 at 8:44 AM, Joel Stransky [EMAIL PROTECTED]wrote: Wow I didn't know that about FD. Gonna have to start using it. I still find myself wanting to use Flex Dev but that's another thread. It's nice to see discussions like this. I feel like some things are foregone conclusions and that I'm late to the part but hey, even Grant Skinner is blogging about cuddling braceshttp://www.gskinner.com/blog/archives/2008/11/curly_braces_to.html . For me, it depends on the complexity of the logic involved in calculating the return. If I'm dealing with a sensible property such as the left boundary for a group of display children, conditionals tend to read cleaner when I can just write: if(this.mouseX grid.left) rather than if(this.mouseX grid.getLeft()). If the property requires more complex code in order to return a value such as looping over an array, I use getVal(). getters and setters also have certain syntax requirements so I also avoid using them whenever I need to do something slightly different such as use multiple parameters. On Tue, Dec 9, 2008 at 10:18 AM, Cor [EMAIL PROTECTED] wrote: When you open the Startpage of FD you find some more shortcuts. HTH Cor -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: dinsdag 9 december 2008 16:14 To: Flash Coders List Subject: Re: [Flashcoders] use get / set functions or make your own Ooh - never knew about that. :-) You learn something every day! Ian On Tue, Dec 9, 2008 at 2:40 PM, jonathan howe [EMAIL PROTECTED] wrote: The magic Context code completion hotkey, which by default is Ctrl-Shift-1, when your cursor is over a variable declaration. This awesome hotkey also does cool stuff like generates an event handler when your cursor is inside an addEventListener declaration... definitely check it out in the FD docs! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.15/1839 - Release Date: 9-12-2008 9:59 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
For clarity, they're referred to as implicit and explicit. get prop / set prop = implicit getProp() / setProp = explicit In AS2, it made a difference because implicits were available right away, whereas explicits were not available for 1 frame. This limitation is not present in AS3. Basically, implicit implies properties of a class, whereas explicit implies methods of a class. I opt for implicit over explicit because this: foo.prop = value; makes more sense than foo.setProp(value); I leave methods for methods, not properties. That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. People who do this private var _foo:Boolean; public function get foo():Boolean { return _foo; } public function set foo(value:Boolean):void { _foo = value; } are masturbating and I'm not impressed by their bloated ego...I mean code. ;) Unless something needs to happen immediately within the class when you set or get a prop (i.e. a state change), it's fine for it to be a public var. It's faster, it's less bloat and most of us aren't writing large applications with a bunch of other developers. Some of these rules were created for when good coders are forced to work with bad coders and the good ones need to protect their code from the bad ones. When it's just you and a couple other devs, and you're all competent, you don't need all these checks and balances that are nothing more than compensation for people who you wish you didn't have to code with. /rant ;) On the FlashDevelop tip: http://www.stevensacks.net/2008/02/21/flashdevelop-code-generation/ http://www.stevensacks.net/2008/04/30/flashdevelop-flexbuilder-style-error-reporting-on-save/ FlashDevelop's auto-completion and code generation are better than anything out there (for AS, at least). And just to be clear, you don't need to select anything for code generation, the cursor just needs to be anywhere within the word, or at the end of the statement. private var _test:Boolean; If the cursor is after the semicolon, you can press the shortcut (I use ALT+2 on Windows, CMD+2 on OSX) and it will bring up the code generation options. The event generation is really valuable, as well. I save so much time with it. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
+1 :-) Use public methods when it's a method, public properties when it's a property. Simple as that.. explicit should only be used for internal things to work, usually called by an implicit setter: private var _data:Object; private function setData():void { // do stuff with _data } public function set data(value:Object):void { _data = value; setData(); } And a *big* +1 for this: That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. regards, Muzak - Original Message - From: Steven Sacks [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, December 10, 2008 5:01 AM Subject: Re: [Flashcoders] use get / set functions or make your own For clarity, they're referred to as implicit and explicit. get prop / set prop = implicit getProp() / setProp = explicit In AS2, it made a difference because implicits were available right away, whereas explicits were not available for 1 frame. This limitation is not present in AS3. Basically, implicit implies properties of a class, whereas explicit implies methods of a class. I opt for implicit over explicit because this: foo.prop = value; makes more sense than foo.setProp(value); I leave methods for methods, not properties. That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. People who do this private var _foo:Boolean; public function get foo():Boolean { return _foo; } public function set foo(value:Boolean):void { _foo = value; } are masturbating and I'm not impressed by their bloated ego...I mean code. ;) Unless something needs to happen immediately within the class when you set or get a prop (i.e. a state change), it's fine for it to be a public var. It's faster, it's less bloat and most of us aren't writing large applications with a bunch of other developers. Some of these rules were created for when good coders are forced to work with bad coders and the good ones need to protect their code from the bad ones. When it's just you and a couple other devs, and you're all competent, you don't need all these checks and balances that are nothing more than compensation for people who you wish you didn't have to code with. /rant ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
on the other hand using public vars makes it more difficult if you have to add an extra parse or an extra function on the returning var for ex. like array.join() or ad some html wrapping around a string Then you don't have to redeclare public _unaltered var to an altered getter and setter and you don't have to go to all off you class local code to change between altered / _unaltered; You just add in the extra functionallity in the getter/setter. As for FlashDevelop it is only ctrl-shift-1. That gives me no time to masturbate. Latcho Steven Sacks wrote: For clarity, they're referred to as implicit and explicit. get prop / set prop = implicit getProp() / setProp = explicit In AS2, it made a difference because implicits were available right away, whereas explicits were not available for 1 frame. This limitation is not present in AS3. Basically, implicit implies properties of a class, whereas explicit implies methods of a class. I opt for implicit over explicit because this: foo.prop = value; makes more sense than foo.setProp(value); I leave methods for methods, not properties. That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. People who do this private var _foo:Boolean; public function get foo():Boolean { return _foo; } public function set foo(value:Boolean):void { _foo = value; } are masturbating and I'm not impressed by their bloated ego...I mean code. ;) Unless something needs to happen immediately within the class when you set or get a prop (i.e. a state change), it's fine for it to be a public var. It's faster, it's less bloat and most of us aren't writing large applications with a bunch of other developers. Some of these rules were created for when good coders are forced to work with bad coders and the good ones need to protect their code from the bad ones. When it's just you and a couple other devs, and you're all competent, you don't need all these checks and balances that are nothing more than compensation for people who you wish you didn't have to code with. /rant ;) On the FlashDevelop tip: http://www.stevensacks.net/2008/02/21/flashdevelop-code-generation/ http://www.stevensacks.net/2008/04/30/flashdevelop-flexbuilder-style-error-reporting-on-save/ FlashDevelop's auto-completion and code generation are better than anything out there (for AS, at least). And just to be clear, you don't need to select anything for code generation, the cursor just needs to be anywhere within the word, or at the end of the statement. private var _test:Boolean; If the cursor is after the semicolon, you can press the shortcut (I use ALT+2 on Windows, CMD+2 on OSX) and it will bring up the code generation options. The event generation is really valuable, as well. I save so much time with it. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
ps we're probably not the first ones discussing this old subject, has n1 found some good sources/references? Most of the old CS textbooks sentence you to hell for using public variables so let's not refer to those ;) On Wed, Dec 10, 2008 at 8:28 AM, Hans Wichman [EMAIL PROTECTED] wrote: Hey, I'm not against using public variables, but I dont like using get set as you did below *if *setting the data has sideeffects outside the area of validation. If you are setting a property and you want to test or verify it or whatever, I can imagine using set get. If you are setting a property and it causes state changes or whatever I like to use an explicit method. Yeah you can mouse over it, codeinspect it or whatever and see it's an implicit get/setter, but just looking at an interface I find it easer to have either public methods or properties and not something in between that lends itself to misuse (ie this set data WAS only validating, but damn now it needs to change state as well, ah heck, lets cram in there instead of ) So for me it's usually either a public var or a method. And there's more behind it than good coders being forced to work with bad coders at least as far as the public variables are concerned, it has to do with the whole mumbo jumbo of the OO asking versus simply taking. An object giving access to its internals instead of an object grabbing access, although in a lot of cases it doesn't pay to make such an academic distinction. I liked the clear explanation Steven gave, although comparing it to masturbating sounds a bit like promoting it ;0) JC And a *big* +1 for this: That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. regards, Muzak - Original Message - From: Steven Sacks [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, December 10, 2008 5:01 AM Subject: Re: [Flashcoders] use get / set functions or make your own For clarity, they're referred to as implicit and explicit. get prop / set prop = implicit getProp() / setProp = explicit In AS2, it made a difference because implicits were available right away, whereas explicits were not available for 1 frame. This limitation is not present in AS3. Basically, implicit implies properties of a class, whereas explicit implies methods of a class. I opt for implicit over explicit because this: foo.prop = value; makes more sense than foo.setProp(value); I leave methods for methods, not properties. That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. People who do this private var _foo:Boolean; public function get foo():Boolean { return _foo; } public function set foo(value:Boolean):void { _foo = value; } are masturbating and I'm not impressed by their bloated ego...I mean code. ;) Unless something needs to happen immediately within the class when you set or get a prop (i.e. a state change), it's fine for it to be a public var. It's faster, it's less bloat and most of us aren't writing large applications with a bunch of other developers. Some of these rules were created for when good coders are forced to work with bad coders and the good ones need to protect their code from the bad ones. When it's just you and a couple other devs, and you're all competent, you don't need all these checks and balances that are nothing more than compensation for people who you wish you didn't have to code with. /rant ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] use get / set functions or make your own
Hey, I'm not against using public variables, but I dont like using get set as you did below *if *setting the data has sideeffects outside the area of validation. If you are setting a property and you want to test or verify it or whatever, I can imagine using set get. If you are setting a property and it causes state changes or whatever I like to use an explicit method. Yeah you can mouse over it, codeinspect it or whatever and see it's an implicit get/setter, but just looking at an interface I find it easer to have either public methods or properties and not something in between that lends itself to misuse (ie this set data WAS only validating, but damn now it needs to change state as well, ah heck, lets cram in there instead of ) So for me it's usually either a public var or a method. And there's more behind it than good coders being forced to work with bad coders at least as far as the public variables are concerned, it has to do with the whole mumbo jumbo of the OO asking versus simply taking. An object giving access to its internals instead of an object grabbing access, although in a lot of cases it doesn't pay to make such an academic distinction. I liked the clear explanation Steven gave, although comparing it to masturbating sounds a bit like promoting it ;0) JC And a *big* +1 for this: That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. regards, Muzak - Original Message - From: Steven Sacks [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, December 10, 2008 5:01 AM Subject: Re: [Flashcoders] use get / set functions or make your own For clarity, they're referred to as implicit and explicit. get prop / set prop = implicit getProp() / setProp = explicit In AS2, it made a difference because implicits were available right away, whereas explicits were not available for 1 frame. This limitation is not present in AS3. Basically, implicit implies properties of a class, whereas explicit implies methods of a class. I opt for implicit over explicit because this: foo.prop = value; makes more sense than foo.setProp(value); I leave methods for methods, not properties. That being said, I don't abide by the retarded rule that you shouldn't have public vars in a class. People who do this private var _foo:Boolean; public function get foo():Boolean { return _foo; } public function set foo(value:Boolean):void { _foo = value; } are masturbating and I'm not impressed by their bloated ego...I mean code. ;) Unless something needs to happen immediately within the class when you set or get a prop (i.e. a state change), it's fine for it to be a public var. It's faster, it's less bloat and most of us aren't writing large applications with a bunch of other developers. Some of these rules were created for when good coders are forced to work with bad coders and the good ones need to protect their code from the bad ones. When it's just you and a couple other devs, and you're all competent, you don't need all these checks and balances that are nothing more than compensation for people who you wish you didn't have to code with. /rant ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders