Lurker News
Back to discussion

Comment by ysavir

ysavir1 reply#
I get what the argument is saying, but there might still be times where I want to find every mention of a variable within a 3-line block. If that variable is a single letter, and possibly a letter that's used 10-20 times in the code in that block, I would consider that block confusing.

Ultimately, I don't think there's any hard rule or standard, just an evaluation of how easy it is to understand the code. Sometimes a single-letter variable will be fine, sometimes not.
But I'd bet a 4-letter variable will always lead to code that is easier to understand.

karmakaze1 reply#
What if the references are all [i] or [i + 1]?
Red_Leaves_Flyy#
Put a comment block at eof defining them and their usage. Use these variables in such a way that ctrl,f replace all with a descriptive name doesn't break anything except the line count and pretty print.

If you want to get really clever, write a script that automatically renames everything and reflows the file on commit.
Damn it. Now I need to make this...