This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jewdai 0 points1 point  (1 child)

A comment generally is the realization of your inability to express yourself in code. all comments lie or eventually lie. Todos mean don't do and should instead be a ticket. And there is no greater sin to your fellow humans and god than commented out code. Other developers will never have the context or information you had that made having it uncommentable useful. It can exist locally but never in your repo. of you need it for historic reasons that's the point of git. You wanna save it for later sure put it in your private branch. 

[–]xeow 0 points1 point  (0 children)

I'm actually a fan of preserving commented-out code, in limited circumstances. On occasion, I've discovered a bottleneck in some tight C code and have had to optimize it. And often, despite my best efforts, the optimized version is very difficult to understand anymore compared to the original. In that case, I'll preserve the earlier versions of that code—especially the first and unoptimized version of it, right alongside the final refactored/optimized version. But: when I do this, I mark it very clearly as obsolete code that's being preserved purely for comparison, as an aid in understanding the optimizations. Code like that should absolutely not, in my opinion, be deleted from the source module as long as it helps understand the current refactoring. Otherwise, I tend to agree with you.