by edw519 · 14y ago · 0 comments
Wrong: Cust & CustCtr
Right: CustID & CustCtr
You should be able to do a global search with any tool and get every instance of that variable with no instance of any other variable.
This pretty much kills "1. 1 char loop counters", which is a good thing.
Why do you think this is a good thing ?
* NB: I am not certain whether I agree with such rules or not, but that is another discussion point.
i ii iii j ij jj ji jjj jij jjj
One letter loop counters and their ilk are always a bad idea. But saying so angers so many people because they can't possibly ever be wrong.
I would offer that you should have tools that are smarter about your code, with a contextual awareness of what things are and how they are used. Many coding purported "best-practices" are based upon such a tool deficiency.
Let me give one example that is a serious peeve of mine -- C# allows you to define region. I have to interact with code that uses regions to define accessibility or type of members.
#region private members
#endregion
This was communicated as a "best practice" because it allows you to hide/show appropriate parts of the code.
Yet the primary tool -- Visual Studio -- has fantastic tools for exactly that use. Tools that don't muddy up the code with unvalidated, quickly out of date metadata (e.g. nothing stops me from putting a public in there).
This holds true for many, many coding conventions. We discarded hungarian notation for the same reason that many of these other naming guidelines are of dubious merit.