this is the question…
This conversation has cropped up again in my work. As far as I’m concerned its not a question at all. You should always use the keyword ‘this’ throughout your classes to explicitly show the path to the object you are accessing or function your invoking.
Its been argued to me that it mucks up with scoping in your class but this is just not the case. When ‘this’ is used correctly you wouldn’t get any scoping problems, this is a case of not understanding scopes properly.
Its also been argued to me that it makes the class look ugly and less readable. Looking ugly is personal preference so I haven’t got a point to argue here except that it probably wouldn’t take too long to get used to it. Less readable? I would argue it makes code cleaner and more readable because the path is defined.
Use ‘this’ all the time!