News for hackers. Stuff that matters.
Re:On Comments in Code by dcolkitt on Tuesday June 15, 2021 @03:33PM (#27520378)
I mostly agree with you, but there are certain cases where you’re making weird and non-intuitive performance optimizations and have to explain “the what”.
Re:On Comments in Code by aequitas on Tuesday June 15, 2021 @04:28PM (#27521066)
But still you have to explain why your code is the way it is on top of that. You can always deduct the what from mentally processing the code, but you can't deduct the why, you only guess.
Re:On Comments in Code by ElijahLynn on Tuesday June 15, 2021 @08:33PM (#27523457)
Definitely agree there are still cases where "what" is useful. Especially in some code that I come across that I just can't grok (e.g. badly named things), I start writing what it does just as a rubber duck method, and I don't have capacity to refactor the whole thing right then, at least I will leave behind a "what" comment because if I had trouble grokking what it does then someone else likely will too.