T
Tim Tyler
I've been playing with the Checkstyle "Require this" check.
http://checkstyle.sourceforge.net/config_coding.html#RequireThis
This forces you to distinguish between local variables,
instance variables and static variables in you code -
buy using "this.var" for all instance variables and
"Classname.var" for all static variables. It (optionally)
does the same for all method calls.
Essentially, I like the effect - but it highlights the need
for a static prefix in Java to match the "this" prefix.
Just as "this." refers to the instance, the static
modifier would refer to the class in which it appears.
Suggested syntax would be "static.var" and "static.method()" -
instead of today's "ClassName.var" and "ClassName.method()".
The rationale is that using the class name all over the place
hinders refactoring and code readability, and violates the
prinicple of specifying each fact in one place.
I believe this change would be a backward-compatible one.
Has this been suggested before?
Does it make sense to you?
Are there any other proposals to deal with the same issue?
http://checkstyle.sourceforge.net/config_coding.html#RequireThis
This forces you to distinguish between local variables,
instance variables and static variables in you code -
buy using "this.var" for all instance variables and
"Classname.var" for all static variables. It (optionally)
does the same for all method calls.
Essentially, I like the effect - but it highlights the need
for a static prefix in Java to match the "this" prefix.
Just as "this." refers to the instance, the static
modifier would refer to the class in which it appears.
Suggested syntax would be "static.var" and "static.method()" -
instead of today's "ClassName.var" and "ClassName.method()".
The rationale is that using the class name all over the place
hinders refactoring and code readability, and violates the
prinicple of specifying each fact in one place.
I believe this change would be a backward-compatible one.
Has this been suggested before?
Does it make sense to you?
Are there any other proposals to deal with the same issue?