Perl: the Markov chain saw | |
PerlMonks |
Re: Of variable {mice} and its name {man}.by FoxtrotUniform (Prior) |
on Jun 02, 2002 at 20:07 UTC ( [id://171060]=note: print w/replies, xml ) | Need Help?? |
Instead of an admonition ("Short variable names are bad! Unless...") I'd suggest a more generous rule: The verbosity of a name should be proportional to its scope If my program's a one-liner, then $i is fine for pretty much any purpose. (Although using $i as a real number would probably weird me out.) In a longer program, $i is probably too short for anything but a loop variable, or maybe an increment in a short function. In general, I try to use the shortest name possible that doesn't need an explanatory comment. So, if I'm working with vertices:
I guess my point is that it's not the length of the name that matters (gnarf gnarf), but whether you need to comment it. --
In Section
Meditations
|
|