|
![](/i/fill.gif) |
On 5-6-2010 10:25, Warp wrote:
> Darren New <dne### [at] san rr com> wrote:
>> I think the same goes for putting "m" or "g" or whatever in for member or
>> global variables, etc.
>
> Why? When I started using those, my own code became much easier to
> understand to me months later. When I have code along the lines of:
>
> void Foo::doSomething()
> {
> mCounter += someValue;
> }
>
> or:
>
> void Foo::doSomething()
> {
> gCounter += someValue;
> }
>
> as opposed to:
>
> void Foo::doSomething()
> {
> counter += someValue;
> }
>
> the first two are much clearer than the third one. The third one doesn't
> make it clear at all where 'counter' might be defined, while in the first
> example it's clear that it's a member variable of the Foo class, and in
> the second one it's clear that it's not. In the third one it could be
> anything.
>
The objection is not to hungarian notation per se*. It is about using it
wrongly. Like any other method of (in-line) documentation, if it does
not match the source it is worse than no documentation at all.
*) though there is the danger that using it without IDE support to
enforce the correct use, will almost certainly lead to mismatches.
Post a reply to this message
|
![](/i/fill.gif) |