←back to thread

873 points belter | 3 comments | | HN request time: 0.237s | source
1. asalahli ◴[] No.42955399[source]
> You literally cannot add too many comments to test code

In my opinion, almost every developer I've worked with who advocated for generous amounts of comments has overestimated their (and or others') ability to write good quality comments.

Obvious ones like `a = b; // set a to b` while useless are also mostly harmless, but I've been lead astray by outright factually wrong comments, many more times than I can count. I certainly don't feel confident in my own ability to not write factually incorrect comments. So yeah, I'd rather the code do the talking.

replies(2): >>42955857 #>>42956593 #
2. adamtaylor_13 ◴[] No.42955857[source]
That’s why your comments should be on things you know to be factual like WHY you made a certain decision. Things like that cannot always be communicated by good variables and functions.
3. Izkata ◴[] No.42956593[source]
I suspect they mean in tests, not in general code as hints about testing. A comment block that explains a bit why that test is doing what it's doing can be amazing.