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

The behavior of your code changes, so comments need to be regularly updated to reflect the current reality.

You do want context there (in the comments), but often greater context (detailed information, that may go out of scope, or not reflect the current implementation of something) should be preserved elsewhere so you know a year from now why you made a decision.

You could keep all the information in the comments and be disciplined about updating them. But when you want to understand something that has changed, you end up needing to remember to go looking in the correct commits for the comments you made at that time. I personally just prefer dated, static notes that won't change and are easy to grep.



I mean keeping the history of decisions in code.




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

Search: