When “Process” Becomes “Busy Work”

When I was a programmer at IBM we had a rule that every line of code had to include a comment from the developer. This had the unintended effect of driving developers to use bad naming conventions for data and functions because the code would be “explained” in the comments. People started reading the comments instead of the code. But at crunch time developers would often update the code but not the comments, putting comments and code out of sync with each other. And an outdated comment is worse than no comment at all. This turns the comment into a lie, and we don’t want lies in our code.

Suppose I have a line of code that reads

 x++; ​/* I am incrementing x here */

I don’t need a comment like that one (/* ...

Get Beyond Legacy Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.