What is the best comment in source code you have ever encountered?
Join them; it only takes a minute:
closed as not constructive by Bill the Lizard Aug 4 '11 at 12:13As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question. locked by Tim Post♦ May 19 '13 at 5:53This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center. |
|||
|
|
|||
|
I am particularly guilty of this, embedding non-constructive comments, code poetry and little jokes into most of my projects (although I usually have enough sense to remove anything directly offensive before releasing the code). Here's one I'm particulary fond of, placed far, far down a poorly-designed 'God Object':
I'M SORRY!!!! I just couldn't help myself.....! And another, which I'll admit I haven't actually released into the wild, even though I am very tempted to do so in one of my less intuitive classes:
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
|||||||||||||
|
|
|||||||||||||||||||||
|
|
This seems to stop morons from messing my code...
|
|||||||||||||||||||||
|
|
||||
|
|||||||||||||||||||||
|
Update: The original author of the code has outed himself so I must give credit where it is due. Dan McKinley left the company I was with shortly after I started, and he talks more about the code, explaining some background and a few more "WTF's" that 'Richard' wrote. |
|||||||||||||||||||||
|
|
|||||||||
|
Wish I were kidding. And knowing the developer who wrote the code, I think he meant it literally. |
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
followed by four nested for-loops |
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
It speaks volumes about our profession that when asked about the "best comment", we all answer with the worst comments we can find... |
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
||||
Never rely on a comment... |
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
From: https://github.com/zepouet/Xee-xCode-4.5/blob/master/XeePhotoshopLoader.m#L108
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
|
About the middle of a 30 page xslt
|
|||||||||||||||||||||
|
|
in a completely uncommented 2000 line method
(I actually grepped out all the brackets one day just to see how bad it was, and, sans formatting, got this:
The endif showed up around line 800) |
|||||||||||||||||||||
|
|
|||||||||||||||||
|
|
|||||||||||||||||
|
|
|||||||||||||||||||||
|