In most IDEs, you can simply mouseover the variable if you want to know. In addition, really, if you're working in an instance method, you should really know all the variables involved. If you have too many, or their names clash, then you need to refactor.
It's really quite redundant.
The Boost libraries for C++ include an article on dimensional analysis that presents a sample implementation of handling units of measure.
To summarize: Units of measurement are represented as vectors, with each element of the vector representing a fundamental dimension:
typedef int dimension[7]; // m l t ...
dimension const mass = {1, 0, 0, 0, 0, 0, 0};
dimension const length = {0, 1, 0, 0, 0, 0, 0};
dimension const time = {0, 0, 1, 0, 0, 0, 0};
Derived units are combinations of these. For example, force (mass * distance / time^2) would be represented as
dimension const force = {1, 1, -2, 0, 0, 0, 0};
Imperial versus SI units could be handled by adding a conversion factor.
This implementation relies on C++-specific techniques (using template metaprogramming to easily turn different units of measurement into different compile-time types), but the concepts should transfer to other programming languages.
Best Answer
According to the Framework design guidelines, when referring to public or protected fields:
For example,
m_
is a prefix.So, public exposure of a field lends itself to the usage of the
this
keyword as explained on MSDNWhen referring to private fields, you can use the
m_
if you want. But, for public fields I recommend following the best practices.Personally, I don't like underscores in my variable names. I also try to be consistent. So,
this.name = name;
is a good rule of thumb to work in both public/private scenarios.