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

Reply via email to