To use this.method() and / or this.myVar or not - there is no difference on methods, it can be on vars - but be consistent in that. I see that he sprinkled all the code, sometimes I even see this.m_myClassVar .
Personally, I prefer to prefix my vars classes with a simple underscore and put the final underscore in my method argument:
public MyClass { private int _myInt; public void myMethod(final int myInt_, final int fooFactor_) { _myInt = myInt_ * fooFactor_; } }
Although most IDEs will make it clear exactly what, I find that this tends to prevent misappropriation and makes it easier to read code intent and IMO.
I use _thisInstance.myMethod() (where _thisInstance is a reference to an outer class) or _thisInstance._myVar , in inner classes / listeners / threads / etc. where I need to clearly indicate which method I'm calling and / or where I need to have a reference to an instance of the class.
Developer Dude Jul 05 2018-11-11T00: 00Z
source share