DEV Community

Jonathan Hall
Jonathan Hall

Posted on • Originally published at jhall.io on

TODO: Add an intriguing title

TODO comments.

Ya love ‘em or ya hate ‘em.

But why are they there?

I think there are broadly two categories of TODO comments:

  1. Something that needs to be investigated
  2. Something you know should be done differently, but you don’t want to take the time right now
  3. Ideas for future improvement

The TODO comment stands in as a little bookmark saying “Get back to me and make this decision or do this refactor some day!”

The trouble is… they almost never actually happen. Don’t believe me? Try this little trick on any code base with TODO comments, which will show you the last modified date of every TODO comment in your code base.

git grep -n TODO | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done

Enter fullscreen mode Exit fullscreen mode

If you actively use TODO comments, and you have zero TODOs, or the oldest is not more than a couple weeks old, I want to hear your secret!

So here’s my challenge to you:

Stop creating TODO comments!

Instead, do one of three things:

  1. Investigate or fix the thing right now. If it’s important, this is the best option.
  2. Simply don’t do the thing. If it’s not important, this is the best option.
  3. In the truly exceptional cases where something is important, but cannot be done immediately, track it in your issue tracker, not in a TODO comment. That is, after all, what an issue tracker is for, right?

If you enjoyed this message, subscribe to The Daily Commit to get future messages to your inbox.

Heroku

Build AI apps faster with Heroku.

Heroku makes it easy to build with AI, without the complexity of managing your own AI services. Access leading AI models and build faster with Managed Inference and Agents, and extend your AI with MCP.

Get Started

Top comments (0)

AWS Q Developer image

Build your favorite retro game with Amazon Q Developer CLI in the Challenge & win a T-shirt!

Feeling nostalgic? Build Games Challenge is your chance to recreate your favorite retro arcade style game using Amazon Q Developer’s agentic coding experience in the command line interface, Q Developer CLI.

Participate Now

AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️