Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • I can't remember where I heard it, but there is an argument that in general commented out code is not harmless as it never gets refactored. Note that this presupposes you will eventually un-comment and re-use that block of code. Commented Aug 24, 2018 at 13:27
  • @PeterM The point here is that it's fine as long as you get rid of it. You should not be leaving commented code in your code base. Something I often do when refactoring is comment out variables to see how many errors that creates to help me understand how much work it will be. Depending on what I intend to do, I might leave it like that until I've resolved all those issues and then finalize the change by deleting the commented code. Commented Aug 24, 2018 at 14:48
  • 1
    I have several code bases I work on that are littered with TODO comments. It’s honestly not so bad because it’s usually 1-2 lines. The thing I like about TODO comments is that my IDE has a “TODO” tab near the terminal that auto-populates with that list of comments, with a preview of the comment and the file/line number. Point is, it’s useful when in a particular company they don’t gasp use Issues even though they use Git/Github. Yeah, well what can you do, try to convince management to use Git Issues instead of Google Sheets? Yeah, tried and failed. Oh well. TODO comments it is! Commented Aug 27, 2018 at 0:05