Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you’re regularly encountering or writing code that only works by accident or doesn’t handle important use cases, it isn’t the fault of a TODO. A TODO should document something that has been considered and would potentially be an improvement, but is not currently necessary. It isn’t supposed to be a flag that says “warning: I’m checking in broken code.” If the accompanying code is actually deficient, reject the PR.


> If you’re regularly encountering or writing code that only works by accident or doesn’t handle important use cases, it isn’t the fault of a TODO.

You're confusing a symptom with the root cause.

TODO items are symptoms of a problem, one which can and does often manifest in code that is brittle and only works by coincidence.

> A TODO should document something that has been considered and would potentially be an improvement, but is not currently necessary.

Not really. A TODO is just a comment someone decided to add because at the moment they spotted something that might require some work, but couldn't be bothered to track it as a work item. Just that, nothing more.

> It isn’t supposed to be a flag that says “warning: I’m checking in broken code.” I

Except it actually is supposed to be a flag that states "yeah I know this is broken code but trust me I'll get around to really fix it at some time between not now and never"

I've lost count of the age-old TODO items I stumble upon on projects I've worked on that served no purpose other than either stating "I think this needs fixing but I can't be bothered to track work items in a ticket" or "I just need my PR to go through, trust me bro I'll do this right once I remember to fix my shit"


This is definitely not the way teams I have been on have used TODOs. It better not actually be broken code. It means “this works but I have an improvement in mind that doesn’t need to be done now.” There is no way I or anyone on my team is getting away with TODOing code that is literally broken.

I’m now legitimately frightened about what some people are apparently labeling TODO. If that’s the way you use it, no wonder you’ve come to the conclusion it’s terrible.


JetBrains IDEs actually highlight two different types of comments:

  // TODO
  // FIXME
I think it's nice to have the distinction, with the former being a general suggestion, whereas the latter is perhaps more urgent.

Not that people's opinions won't differ greatly anyways. Some might set up their static code analysis to complain about every single TODO item and actively manage them with their issue tracking system, others just won't care.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: