| Hopefully no one even moderately unfamiliar with the language the code is written in needs to find out how to fix something that is broken. Citing breaking code by using some global that makes the comment no longer true? Sounds like an abuse of globals or someone not cleaning up the comments, not the comments themselves. So many times I have had to repair code in languages I wasn't quite familiar in or that was simply using methods I hadn't learned yet. Those comments were life saving. Comments describing intentions of code also allow for someone to come by later and quickly and concisely understand what the code was doing and where it was going. I cannot think of a single instance where parsing 65 lines of a function definition was ever quicker than reading: This method takes a foo object, applies HTML encoding, and returns an array of the original and the clean code. In the same vein, saying that Unit Tests are a replacement for comments just brings me back to my original assertion: I already am looking for help understanding the code base, so I should look at more code elsewhere and parse another long list of assertions? Bad comments are bad like bad code is bad, or like bad pie is bad. But comments, code and pie aren't bad. Please don't stop commenting your code because you feel like you can be more clever with the language instead. Someone may be much more familiar with the language the comments are written in. They may may need to do something with what you wrote. Whenever I read some new reason why comments aren't cool or why some programmer has decided they[1] can just be clever with the language, I can't help but think they just don't have enough experience to know why and how comments can be absolutely necessary and fantastic. [1] not saying this is necessarily true in this case, it's just the impression I get. |