DEV Community

Jonathan Hall
Jonathan Hall

Posted on • Originally published at jhall.io on

1

Why "Consider refactoring this" comments are silly

Yesterday I listed three causes of TODO comments. I want to call one of these types of comments out as particularly silly for teams practicing modern, agile software develpoment:

Ideas for future improvement

These comments take many forms, in my experience. Here are a few examples from real code:

  • TODO: Consider something more robust
  • TODO: Consider using dynamic imports for lazy-loading
  • TODO: Add more test cases
  • TODO: Consider adding a GetAll() method

So why do I think these are silly?

Because none of these TODO comments stands alone. Nobody (unless they’re utterly bored) is going to run into one of these and think “Gee, today would be a great day to add that GetAll() method!”

If any of these TODO comments are actually resolved, it will be in service of another purpose (i.e. “I really need some way to get all elements from this object, for this new feature I’m creating”). And in such a case, the TODO comment is entirely extraneous.

Not only that, but it should go without saying that all code is always subject to refactoring when the need arises. That’s part of evolutionary design. Adding a comment to that effect is just noise.


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

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more