My 2c worth...
As we spend so much time looking at code, it should be as clear as possible,
to help us understand what we are looking at, to achieve that I follow a
strong naming standard on all projects I have control over.
· Class/object variables start with an underscore.
· Method argument variables start with an “a” (argument).
· Local method variables start with an “l” (local).
Also I switch off all auto formatting so I can do it myself better than the
machine will do it, so you will see my code looking like:
// Instance private data
private string _Name ; // The name that the member is known by
private string _MemberNumber ; // Membership number
private int _expiryMonth ; // Month that the membership expires range
= 1..12
private int _expiryYear ; // Year that the membership expires
// (four digit years, so 2010 is 2010, not
10)
Our brains are very good a pattern matching, so we should help them with
this sort of layout style.
I have a rule I call the 3am rule, you should be able to look at code at 3am
and immediately be able to understand what it does and how it does it. If
you can’t, you need to refactor your code for clarity.
All the best
Greg Harris