this post was submitted on 27 Nov 2023
297 points (92.3% liked)

Programmer Humor

19817 readers
1177 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 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] takeda 45 points 1 year ago (5 children)

I'm Bill I don't comment my code (except complex parts), instead I try to make code clear, including using proper variable and function names and try to keep functions short. I don't think I ever got lost in my own code in my 20+ years of experience. Even got complements about it.

The programming language is meant for humans to read/write, if you need to put comments to understand your code then your code sucks.

[–] [email protected] 32 points 1 year ago

Commenting is an art. Too much and it is outright misleading after the first hotfix. Too little and only the original developer can maintain it

But uncommented code is a dick move. And, more importantly, it means you can't punt bug fixes to the intern

[–] suodrazah 22 points 1 year ago

Use comments to describe the philisophy of the code, the why. And any non obvious extended relationships. Risk. Etc.

Comments on function are typically a waste of space.

[–] [email protected] 10 points 1 year ago

When writing basic business code, structuring the code well and having good naming standards means you shouldn't need a ton of comments, but you should still have some. Plus, using structured function content blocks gives you intellisense in some languages and IDEs, which is important for code reuse in teams.

However, when I was doing scientific programming I'd have comments for almost every line at times where I put the mathematical formula and operations the line represents. Implementing a convolution neutral network with parameters to dynamically scale the layers or MPI stochastic simulations is much different than writing CRUD functions or basic business logic.

[–] [email protected] 2 points 1 year ago

I think that makes you Phil, not Bill. Thanks for the good work you do Phil.

[–] [email protected] 1 points 11 months ago

Comments are there to make your ctrl + f’s faster