this post was submitted on 10 Jun 2024
176 points (100.0% liked)

Programmer Humor

421 readers
18 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
 

Comment from my group project teammate. You don't need to comment every line lol

you are viewing a single comment's thread
view the rest of the comments
[–] user224@lemmy.sdf.org 13 points 5 months ago (2 children)

I am not a programmer, I just barely wrote one bash script in the past. But I'd say more comments are better than too few.

When I later wanted to edit it, I got completely lost. I wrote it with absolutely no comments.

[–] floofloof@lemmy.ca 3 points 5 months ago

I've been programming for almost 25 years and I'd still rather see too many comments than too few. A dogmatic obsession with avoiding comments screams "noob" just as much as crummy "add 1 to x" comments. If something is complex or non-obvious I want a note explaining why it's there and what it's supposed to do. This can make all the difference when you're reviewing code that doesn't actually do what the comment says it should.

[–] 01101000_01101001@mander.xyz 1 points 5 months ago* (last edited 5 months ago)

While this is true, an alternative is to name your variables and functions descriptively so that when you see number_of_cats you know that variable is the number of cats, and buyAnotherCat() is a function that increases the number of cats.