in reply to The art of comments: (rave from the grave)
Besides the other sorts of comments people are likely to mention, I like the WTFWIT (WTF Was I Thinking) sort. Often times we write odd code to get around some special case or problem (real or imagined), but then we completely forget about what that problem was later. For instance, a remote system might return an odd result because it had a bug, and that bug has disappear. Or, more commonly, the "my brain is mush" explanation
OR# the remote side is supposed to use semicolons, but in # this one case we tickle a bug in blah blah blah that # makes it use tabs so change the tabs to semicolons $foo =~ tr/\t/;/;
# i know there is a better way to do this, but it's 3 am # and I'm an idiot
I don't put these into the category of "good documentation", but I find them useful so I can think about what the programmer was going through when he was typing that stuff. It's completely subjective material that reminds us that programming is a human endevour. Anything that can help the maintenance programmer see what the original author was thinking is helpful :)
And, as one of my early programming mentors said in his coding standards "All clever-ass tricks must be explained in the comments for us less clever types."
</code>
|
|---|