Roland Pibinger said:
To wit, real gurus use one-letter names.
Yes and no.
Most individuals and organizations go through a phase where the believe that
more documentation will solve every problem in the universe. Individuals
usually outgrow this.
One has to make a decision about comments, for example: is it necessary to
document something a person should know or would immediately figure out?
For example, these comments add no value.
#define MAX (2) /* MAX is now 2 */
for (i=0; i<MAX; i++) /* For each i, 0..MAX-1 */
Some comments actually add negative value: it takes unnecessary work to
compare the comment to the code.
K&R, just by the design of the C language, had reached the point where they
realized that typing for the sake of typing adds no value. The "{" and "}"
block delimiters in C are pure genius (compared to the "begin" and "end" of
Pascal). Similarly with +=, ++, /=, ^, etc.
It is the same for function parameters ... "s" and "t" are fine. It adds no
value to say "source" and "target".
And even for a formal parameter that is more complex, I'd be more likely to
add a comment than to type the same long name over and over again. For
example:
/* INPUTS
** gpa : grade point average
** nfa: number of fireworks accidents
** asm: Lifetime number of Arnold Schwarzenegger movies watched.
**
** OUTPUT
** [0,1], probability that the individual is an idiot.
*/
double compute_probability_of_being_an_idiot(double gpa, int nfa, int asm)