A lot of times I'll see code like this:
...
s = reader.readLine();
... //many lines that use s
If your method is very small, this is ok, but if it's a long method where s is used for many lines, this code becomes difficult to understand. The
next person that looks at this code will be forced to look at the instantiation of s to figure out what it represents.
It's better to give your temporary variable a descriptive name in that situation:
...
line = reader.readLine();
... //many lines that use line
Or better yet:
...
logLine = logReader.readLine();
... //many lines that use logLine
name_your__temporary__variables_well, Rev. 2, Last changed on 2008-01-09 21:21, 136 page hits