4 ms·
Especially if it's not a copy-paste job. If there's any adjustments or even a rewrite, the comment should include the reason why the changes were made. The next
by inetknght 7y ago
Especially if it's not a copy-paste job. If there's any adjustments or even a rewrite, the comment should include the reason why the changes were made. The next guy coming along might not realize that changes were needed
- nradov 7y agoIt's usually better to put that information in the revision comments when you commit rather than in the code itself. Otherwise the code accumulates layers and layers of comments over years.
- penagwin 7y agoI feel like it depends - I know I don't just start digging through the commit history of every line I edit. If I'm trying to fix a bug, and only have to change one line for it to start working, and the tests still pass - but that line was there for a reason that wasn't commented (some edge case) - I'll likely miss it.
- jonreem 7y agoPersonally, I've developed a strong preference for putting this type of information as close to the affected code as possible. Immediately next to the affected code is the only place these types of comments have a prayer of being kept up to date. Keeping them in another document, a commit message, or anything similar just results in the content of the message instantly going out of date.