Quote:
I've never really understood why some people get majorly obsessive about commenting code - I don't know how many times I've heard "code without comments is bad".

Generally speaking, your code should speak for itself, if it isn't then there's something wrong somewhere! I know that in practice this isn't always possible, but when I come across a situation like this, a single line comment usually suffices.

Like above, giving variables and functions proper descriptive names is about the biggest favour you can give yourself and others who access the code.

Bad code is bad code, no amount of commenting is going to fix it!


I think a lot of it has to do with what you are actually working on. When I'm doing a flight model, I comment the hell out of the code - with multiline explanations in certain areas to make sure I remember what term I am currently calculating and how it fits into the big picture. Even with all that code, going back over some of my old stuff that I haven't seen for six years or so is still confusing.

I guess there is a direct relationship between the amount of commenting necessary and the complexity of the problem.

- Tim