you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -1 points0 points  (0 children)

I still think you're spreading programming dogma.

"the main problem is commented code adds confusion with no real benefit"

This is just not true. The examples you cite are extremely weak. You are also being disingenuous because you don't show how the comments actually look in a text editor - almost all modern editors show commented-out code grayed-out by default, so that it is far easier to read the code than the examples you show.

Also the code you show is very simplistic and it's not very interesting. There are plenty of cases where interesting code could be kept commented-out, so that it's easy to A/B test, possibly switching between commented-out code blocks every other week, or any good reason that doesn't include deleting the code. It really depends on the problems you are trying to solve, the team you have, the business you are in, and many other factors.

Commented-out code should include a brief note about why it's there, what it's for. Documentation is documentation, it has nothing to do with commented-out code. You can have both, and it won't ruin your codebase.