1531
(page 2) 50 comments
sorted by: hot top controversial new old
[-] Maalus@lemmy.world 6 points 1 month ago

How bad programmers comment their code. Good programmers don't comment at all and let the code speak for itself, leaving commenting to some obscure and arcane implementation the coder left in after a week long binge on caffeine and gummy bears.

[-] BombOmOm@lemmy.world 11 points 1 month ago* (last edited 1 month ago)

Code should absolutely speak for itself. But the occasional comment is still good to explain the 'why' of the code when the why isn't very obvious, often due to a niche requirement. Also any time you have to break out a hack, that needs comments up the ass, what was the bug, what URL did you find the fix at, why does this hack work, etc etc. It's very satisfying to go back and remove those hacks after they are no longer needed, often because the underlying technology fixed the bug that had to be hacked around.

load more comments (2 replies)
[-] magic_lobster_party@kbin.run 6 points 1 month ago* (last edited 1 month ago)

This is the truth. In my experience, the people who often writes comments are also writing the most incomprehensible code.

Comments are frequently getting outdated as well, so they’re not in great help understanding the code either.

[-] CodexArcanum@lemmy.world 4 points 1 month ago

I was rewriting some old code of mine and ended up stripping out the comments. I kept reading them instead of the code, which I had been changing, and they were irrelevant. (I added new comments back in, though a big reason to rewrite was to make the code more self-explanatory.)

load more comments (3 replies)
[-] navi@lemmy.tespia.org 5 points 1 month ago

A real comment in our junior year game engine codebase.

load more comments (1 replies)
[-] isVeryLoud@lemmy.ca 5 points 1 month ago
[-] Andromxda@lemmy.dbzer0.com 3 points 1 month ago

I don't know. Anyway, DankPods is awesome, there's a great Lemmy community dedicated to his channel: !dingusland@suppo.fi

load more comments (1 replies)
[-] zerofk@lemm.ee 3 points 1 month ago* (last edited 1 month ago)

Our code base is filled with “//constructor”, “//destructor”, “//assignment”, or the ever enlightening “Foo GetFoo(); // GetFoo”.

This is not what they mean by self-documenting code.

load more comments
view more: ‹ prev next ›
this post was submitted on 06 Jul 2024
1531 points (99.4% liked)

Programmer Humor

18872 readers
726 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