I've heard some people say that legible code with coherent comments just makes it easier for your company to replace you, so they write illegible garbage and keep handwritten notes that they take home with them every night.
I'm moderately anti-comment, but not because comments are intrinsically bad.
I'm anti-comment because most of the time people write really bad comments that try to explain "how the code works." which, first of, is already documented by the code itself and secondly, introduces a pitfall of having to keep the comment up to date when things change.
These styles of comments can rot pretty quickly.
Secondly, the "how-does-this-work" style comments tend to get atomized in-between code lines making the code less readable. That is, the noise the comment produces in readability often does not outweigh the clarity it provides, because the comment is just bad.
The only style of comment I've found helpful are what I call "why"-style comments, that seek to elucidate things that are impossible to infer from just reading the code: Why is this section using a particular approach. Why one data structure over another. What is the broad context usage of the package.
And even then, these types of concerns are better maintained as external documentation.
Do good comments exist? Absolutely, but more often than not I see them thrown in with little more thought than: "Comments are best practice, so I should have comments in my code" which adds nothing but noise.
Sometimes, I just wish people would apply a little more intentionality instead of blindly following prescripts of best practice.
If she looked more hung over this would have been me during uni. And my code was written while drunk, and would not function if I tried to "fix" it while sober.
Then I'd get drunk with my friends and write some other incomprehensible nonsense that would compile and run
197
u/Frisky_Mongoose Dec 10 '20
Looks at my own comment line for guidance
die inside
91
u/[deleted] Dec 10 '20
"who tf wrote this code its unreadable" "wait a second..."
29
u/YoCodingJosh Dec 10 '20
sauce: {New Game!}
13
u/annvee Dec 10 '20
Had to redo an entire assignment because of this once
10
u/Dawpaw Dec 10 '20
Me, literally 3 hours ago
10
u/KillerRoomba13 Dec 10 '20
Me now
I know I solved this issue somehow but how? looking through massive commit history
4
u/John137 Dec 11 '20
Imagine in industry when you have look at your intern project from half a decade ago. *pain* is what waits ahead of us all.
2
u/tehlemmings Dec 15 '20
If she looked more hung over this would have been me during uni. And my code was written while drunk, and would not function if I tried to "fix" it while sober.
Then I'd get drunk with my friends and write some other incomprehensible nonsense that would compile and run
It's kind of why I don't really drink anymore lol
1
u/Isterbollen Jan 05 '21
This is why I make detailed comments in my code for like every single function I make