views:

458

answers:

19

I'm writing a chapter of my dissertation that deals with contextual cues and I'm looking for good examples of comments (or todo comments) where it's obvious that whoever wrote them had some knowledge that he didn't bother sharing with future readers, making them difficult to interpret.

Examples from publicly available code would be especially appreciated!

I am looking for both actual comments (header or on a piece of code) and todos.

A: 
//todo: Fix me
Alan
+2  A: 
// TODO:  update TODOs
MusiGenesis
What language is that? Normal back slashes for comments?
Robert Gould
The language is "I". It's short for "I am an idiot who can't code without an IDE".
MusiGenesis
Hehehe, cool however I suggest you upgrade to I#
Robert Gould
The next version is III (pronounced "ay-yi-yi").
MusiGenesis
+2  A: 

I think the most useless TODO I've encountered the most would be:

//TODO: fix this

Robert Gould
It's not that useless, it acts as a marker so that you can easily search the project for things that are still "to do". Obviously it would be more helpful it indicated how "this" was broken.
Dan Dyer
I see that one a lot, the problem is nobody knows what neeeds fixing.
Kent Fredric
+1  A: 

Check out The Daily WTF, especially the CodeSOD section. They should have something that fits the bill.

gfrizzle
A: 

I don't like TODOs that don't explain the problem, but only say what should be done instead, like

// TODO: better use mergesort...
Johannes Schaub - litb
+2  A: 

One I ran across on my current project, written by a contractor that is no longer there:

//TODO: Temporary fix until we can solve this problem

and of course no mention of the original problem... thanks!

rally25rs
I've used them before.
Bill the Lizard
@Robert: I meant I had used that *contractor*. :)
Bill the Lizard
@Bill Well then you aren't welcome to our club :(
Robert Gould
A: 
// this broke something
// *actual code/santity check that made everything secure here*

The problem here of course being, commenting was used to solve the wrong problem. Instead of solving the problem, the code which brought the problem into being recognised was commented instead.

The squeaky wheel doesn't get the oil, the mechanic instead gets given earmuffs and a blindfold.

where it's obvious that whoever wrote them had some knowledge that he didn't bother sharing with future readers

Here, its obvious whoever wrote them had a lack of knowledge in one field, and instead of diagnosing the problem in their own code, .... proliferated the the breaks responsibility, and suppressed the warning :/

Kent Fredric
A: 
//sorry about this
amdfan
+6  A: 

Here's an example of a comment that should have been paid closer attention, but wasn't.

MD_Update(&m,buf,j); /* purify complains */

The author of the comment was trying to communicate that the line of code caused the Purify tool to generate a warning. The line of code was removed because of the warning anyway, and that's why Debian and Ubuntu users had to update their SSL keys last May, after the line was added back in (hopefully with a more strongly-worded comment).

Explanation from an expert here.

Bill the Lizard
Thanks, exactly the kind of thing I was looking for!
Uri
A: 
// someguy: Neato!  I can ...
// otherguy: Not so neato.  That doesn't work and here's why
JaredPar
+2  A: 
// Do dis ting!

Really. Used throughout the app, too.

Jon B
+2  A: 

Two that I myself didn't find but were found by a friend while working with an open source project.

Example 1

// Drunk, fix later

Example 2

// Almost always true
return true;
JaredPar
A: 
    //TODO there must be a better way to do this
    // TODO: This is UGGGLLY

And of course, the succinct

    // TODO
Donnelle
+1  A: 

A few skimmed out of the Perl debugger:

# Here begin the unreadable code.  It needs fixing.

# XXX I have no idea what this is doing. Yet.

# XXX It behooves an OS/2 expert to write the necessary documentation for this!
Joe McMahon
A: 
//TODO: Find the bug

While the code was working perfectly fine

Eric
A: 

Found this one just the other day:

//TODO: or not TODO.  That is the question.
joseph.ferris
A: 

I keep meeting comments on the form

// TODO: Find out why this doesn't work.
Pål GD
+1  A: 

I found this gem from code I wrote about 16 months ago

### You don't want to use SQL merge (trust me)

Problem is the code that ran under that comment ran a SQL script that used MERGE. Now I'm working through the fact I don't trust myself.

Milner
A: 

Found this in my own code once: never got around to fixing it.

//TODO: FIX ME
//TODO: I don't know how TODO this.
tsps