15

I suspect this question has been asked before, but it's not easy to Google for.

I am a fairly new coder and I see a lot of code, in a lot of different languages, with comments beginning "TODO".

Questions:

  • Is there a practical reason why people write TODO in all these different languages, or is it merely a convention?
  • If the latter, where did the convention come from?

I can see why it's useful to be able to grep for TODO, I'm just curious about the history behind it.

1
  • I used to think I was the only one who did this until I saw it in someone else's code and was surprised. One of the reasons I like TODO is that in spanish, todo means everything, and since I always use TODO for all unfinished tasks in my code, I can make sure I capture everything Oct 6, 2022 at 7:08

4 Answers 4

13

Programming is a world-wide activity; conventions to help smooth the process of working with people who are not native speakers of each other's languages are worth their weight in gold. TODO, XXX and FIXME are often highlighted by IDEs, which provides an excellent incentive to stick with these options.

  • XXX suggests a danger or hazard that maintenance programmers must be aware of;
  • FIXME insinuates that something is wrong with some implentation which needs to be changes;
  • TODO explains shortcomings that would be nice to address.
2
  • 6
    TODO because it is common for people to maintain to-do lists -- things to do. XXX because it is visually so much denser than usual text.
    – sarnold
    Feb 29, 2012 at 12:29
  • 1
    In spanish TODO means EVERYTHING so it can be confusing for begginers
    – Juan Perez
    May 29 at 15:12
4

TODO means "to do". Something that someone will need to do. Just guessing, but could this guess be wrong?

2
  • 1
    Sure, but I just wondered whether it had any other significance (e.g. whether IDEs provided a programmatic way to handle them, as @sarnold's answer suggests).
    – Richard
    Feb 29, 2012 at 12:28
  • 4
    But why TODO and not To-do or ToDo?
    – Widor
    Feb 29, 2012 at 12:55
2

In addition to the comments about grepping, editor/IDE identification etc. I would think that a big reason as to why TODO became the standard, instead of say todo or ToDo, is simply that TODO is a big todo.

1

Just a quick follow up to the original answer: This feature is mainly a reference and you'll find it in Frameworks if there are items that aren't detrimental to the code still running, but that the developers would like to address.

The nice thing about modern IDE's, for example I use JetBrains PHPStorm, they actually highlifht TODOs and place them into a Toolbar for your entire project so you can see all the TODOs for all your files differentiated by their directory and file name.

Anyway, just thought this may add further light as to why you may see it throughout code.

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