Re:Is there an excuse for short variable names?
by bane on Saturday February 02, 2013 @07:58PM
(#5158039)
it sounds very programming 101, but I've found getting into the habit of boring old comments at the top of all my methods/functions explaining what the function does, what the input should be, what the output should be, and then simply putting some comments near the top talking about what all the variables are, what they do, why I have them etc. (usually only 4-10 words)...it sounds dumb and time consuming...but this little bit of polish has pulled my ass out of the fire more times than I care to count, and actually helped me write saner code more times than I care to admit (since sometimes writing out the semantics of this stuff helps clarify thoughts that get muddied and confused in the details of code).
you don't have to do this while you're writing the code, often-times just hammering the code out gets you something running, but then doing this after the fact really helps.
you don't have to do this while you're writing the code, often-times just hammering the code out gets you something running, but then doing this after the fact really helps.