Mike Anderson wrote:
> Greetings All,
>
> Whenever I study code generated by seasoned programmers (i.e. all the
> Adobe people supporting Flex on this list) as well as countless others
> on this list, I notice that some use "this" when referencing local
> variables contained within a Class.
>
> The last thing I want to do here, is start a heated discussion regarding
> "best practices" for programming. My goal on a daily basis, is to
> better myself as a programmer, and I want to make sure that the code I
> create, conforms to certain standards.
>
> Could some of you please offer your 2 Cents regarding the
> advantages/disadvantages of using "this"? Just a quick example:
>
> package
> {
> public class myClass()
> {
> private var testVar:String;
>
> public function myClass( value:String )
> {
> this.testVar = value;
> // versus:
> testVar = value;
> }
> }
> }
Something to consider is the naming of the function parameters used.
eg)
public class myClass()
{
protected var valueOne:String;
protected var valueTwo:String;
public function myClass( valueOne:String, valueTwo:String )
{
this.valueOne = valueOne; // ok
valueTwo = valueTwo; //?? erk
}
}
}
cheers,
- shaun