What is the best comment in source code you have ever encountered? (2011)
Report a link problem
The originally submitted URL now redirects to the address above. Updating the destination does not change the item’s HN history, Hall membership, or rank.
Submission timeline
2007–2026One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.
First comments on top threads
HN comment orderIn a unit test: # And what father is there among you, who, # if his son asks for a slice of bread, # will offer him a stone? # or if he asks for a fish, # will instead of a fish offer him a snake? my $fish = 'one-fish two-fish red-fish blue-fish'; my $snake = 'oooh! a snake! ooh! snake! ooooooooo!"; (Unit test proceeds to insert both $snake and $fish into a cache object, does a little bit…
loop ... ... // sleep 10 sleep 7 // Changed from "sleep 10" on 11-19-05 // by jvj because Bruce in Buffalo bitched // that it ran too long. Now he's happy. // The next time he bitches, change it to // "sleep 5". That oughta buy us another // year before we have to rewrite it. ... ... until done do repeat
Linux driver >"Do not purchase this card, even as a joke." https://elixir.bootlin.com/linux/v3.1/source/drivers/net/3c5...
This one is by far the best: Dear maintainer: Once you are done trying to 'optimize' this routine, and have realized what a terrible mistake that was, please increment the following counter as a warning to the next guy: total_hours_wasted_here = 16
The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.
- Breakout years
- 2
- Total points
- 356
- Total comments
- 162
100+ points or 50+ comments
reference only — not used in Hall rules or ranking
reference only — not used in Hall rules or ranking