Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, good code obviates the need for most comments. A comment shouldn't cover up a bug of clarity in a piece of code, in almost any case imaginable (basically, if it isn't a Fast InvSqrt() level of utility, the dev ought to reconsider the "cleverness" of the code). And anyhow, the implementation details of the code are liable to change; the comment becomes outdated, and there's a good chance that it won't be updated.

What about a comment that notes what part of a spec some code implements (i.e. something outside the actual behavior of the code)? A comment that answers "why" can be helpful, and can sometimes be worth the high cost that an unchecked, unexecuted part of the program inherently carries.

If Fowler's claiming that all comments are bugs, I'd call that damaging.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: