Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm doing the same. When there is something "to-do" in my code, I write //TODO .... But I'm curious to know when this started and if there is a reason for writing "to-dos" in all capital letters?

share|improve this question

closed as not constructive by ChrisF Jun 11 '12 at 10:11

As 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.

19  
Because we really MEAN IT (we just never actually get around to it) –  Anthony Pegram Dec 23 '11 at 23:16
3  
so editors can mark them and let you search through them (eclipse's task list for example) –  ratchet freak Dec 24 '11 at 0:54
6  
Since you couldn't actually make text bold inside the code you needed some way to make important things stand out. Hence... –  Karlson Dec 24 '11 at 3:44
4  
Why does it matter? –  ldigas Dec 24 '11 at 3:59
3  
I write //todo:... –  BЈовић Dec 24 '11 at 13:18
show 1 more comment

8 Answers 8

up vote 21 down vote accepted

Also, it's great to have a way to easily search for code sections you glossed over and want to get back to. You can do a case-sensitive search for "TODO" to immediately find what you skipped before.

"todo" (lower-case) could potentially be part of a larger word/function/variable, but "TODO" (upper-case) is probably not going to be.

share|improve this answer
4  
It also allows editors to highlight this. gedit does it, for instance, and it only does it for all upper-case TODO. Whatever the reason, it's enough incentive for me to write it in upper case. –  delnan Dec 23 '11 at 23:49
4  
@delnan: That's a tautology. It was done to stick out, so people used it, so somebody added the syntax highlighting in vim to stand out more, so people use it to stand out. People don't use it because the editor makes it stand out they use it because it is common to do so and thus the editor makes it stand out. You can make anything stand out in vim just change the syntax highlighting appropriately it is just as easy to make todo stand out but there is little point in that as the convention is to use TODO. –  Loki Astari Dec 25 '11 at 9:06
1  
@LokiAstari: As I said, I for one spell it in capitals because more editors highlight that by default. But perhaps I'm an exception: Quite young (so I couldn't have done it before editors supported it) and (sadly) too much of a whimp and lazy bum to adjust syntax highlighting manually. –  delnan Dec 25 '11 at 9:43
    
Also nice for the poor guy who needs to clean up after you, and for anyone who needs to look over your code before it's complete. They can see at a glance what's not yet done because of this convention. –  sq33G Dec 25 '11 at 12:25
2  
I have encountered mixed-case TODO within a variable name like filesToDownload. Of course, "whole words only" search fixes that problem. –  dan04 Jan 20 '12 at 3:25
show 1 more comment

I'm curios to know when this started and if there is a reason for writing to-dos all capital?

The idea with comments like TODO and FIXME is to make them stick out. You generally don't want to ship code that has such markers in the code -- they mark things to be done before the project can be considered complete. Using ALL CAPS makes them a little easier to spot, provided you don't use ALL CAPS for a lot of other things in your code too.

share|improve this answer
add comment

Both Eclipse and Visual Studio have Task List features that automatically give you lists of comment lines that have TODO in them.

share|improve this answer
    
Visual Studio started doing the // TODO: comments when it first added the code generators for MFC boilerplate stuff. That was version 2.0, iirc. –  mjfgates Dec 24 '11 at 5:05
    
at least for Visual studio this search is not case sensitive - it will pull //todo foo into the task list too –  jk. Jun 11 '12 at 13:39
add comment

I just stands out and is easy to catch... nothing complicated!

share|improve this answer
1  
that and its easy to find via grep or the like –  Zachary K Jan 20 '12 at 7:43
    
@ZacharyK: Exactly! –  Dynamic Mar 3 '12 at 20:35
add comment

It calls attention to the fact that there exists a todo.

It is important that it be obvious all the time that someone needs to come back to the code. The particulars only need to be known by the person coming back to address whatever the issue is.

share|improve this answer
add comment

If you are a vi user use:

/TODO

It will get you there very fast.

share|improve this answer
    
Other editors have search features and you can just as easily search for todo. –  Karlson Dec 24 '11 at 3:48
    
Except 'todo' might appear in something else like a variable name, or other comment text... –  sevenseacat Dec 24 '11 at 9:38
1  
vi is case-sensitive. Since caps are used sparingly in most modern languages (in things like named constants), the search has a high probability of success. –  ncmathsadist Dec 24 '11 at 22:19
add comment

Some editors only highlight uppercase TODO items, so it's safer to always use uppercase.

share|improve this answer
add comment

Visually ALL CAPS stands out, but isn't very legible. When reading code they scan as a block of a particular size. It doesn't really matter what the letters are. They just stand out and can be seen very quickly. Once you have been working with the tags for a while, your brain will recognize the word by shape.

From a tools (IDE/Editor) standpoint, case sensitive search will have a very low false positive rate on all caps versions. In some coding styles there is a small risk that a constant will be matched. Case sensitive whole word search makes false positives even less likely.

Once the tool gets it on screen the format clearly says look HERE. Once you are focused on the location, the legible part will be the related comment.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.