3 ms·
This is what source control blame is for. It’s very hard to estimate what business reasons will be important to readers of code in the future. I very often nud
by xixixao 5y ago
This is what source control blame is for. It’s very hard to estimate what business reasons will be important to readers of code in the future.
I very often nudge people to remove their comments entirely. Less experienced devs often write comments to explain code, instead of spending time on making the code itself readable/understandable. I often ask: “Can you modify the code such that the comment will become obsolete?”
- rmbyrro 5y agoExactly, it's better to document on the VCS. Comments there will be tied to that version of the code, can never go out of sync. It's also good to learn how that piece of code evolved and what reasons to change. Avoids repeating past mistakes.
- ijidak 5y agoHard disagree with this. Yes, code should be easy to understand. But well-written comments that explain assumptions and intent helps as code evolves over time. Also, comments are quicker to scan than code itself. A good comment can indicate code that can be ignored for the purposes of certain troubleshooting. Finally, junior developers usually write code that is difficult to understand and don't comment. I've rarely ever seen a junior developer that both writes unreadable code and takes the time to write comments. Usually comments are a sign of seniority, someone who has pity on those who will come after him/her. And thus that person tends to also write understandable code. Perhaps there's an uncanny valley in between where comments are a band-aid for complexity, but I have never observed that in years of working with many developers.