284
submitted 9 months ago* (last edited 9 months ago) by ShitOnABrick@lemmy.world to c/programmer_humor@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] SpeakinTelnet@programming.dev 6 points 9 months ago

I don't care how much you think your code is readable, plain text comments are readable by everyone no matter the proficiency in the programming language used. That alone can make a huge difference when you're just trying to understand how someone handled a situation.

[-] Zagorath@aussie.zone 5 points 9 months ago

Comments explain why, not what. Any comments that explain what a section of code is doing would probably be better off as separated methods.

Apart from basic documentation comments, like JavaDoc or C#'s XML documentation comments.

[-] SpeakinTelnet@programming.dev 4 points 9 months ago

There's nothing limiting what a comment should be as far as I know.

As an example of what I mean, I've seen in a 10k+ lines python code a few lines of bit manipulation. There was a comment explaining what those lines did and why. They didn't expect everyone to be proficient in bit manipulation but it made it so that anyone could understand anyway.

[-] Zagorath@aussie.zone 2 points 9 months ago

There’s nothing limiting what a comment should be as far as I know.

Nothing technical, sure. Just good coding practices.

[-] Fal@yiffit.net 2 points 9 months ago

There's nothing keeping the comments up to date with the code. Comments should be sparse and only on sections that aren't obvious why they're being done

[-] lorty@lemmygrad.ml 1 points 9 months ago

Then someone needs to change something about the code and doesn't bother updating the comment. Now you still have uncommented code but with a comment that confuses instead of helping.

[-] SpeakinTelnet@programming.dev 7 points 9 months ago

IMHO the issue in this situation is not the comment but that the person updating the code didn't do his job properly which shouldn't be an excuse not to do it from the start.

this post was submitted on 27 Nov 2023
284 points (91.5% liked)

Programmer Humor

19207 readers
1305 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS