this post was submitted on 06 Jul 2024
1547 points (99.4% liked)

Programmer Humor

19564 readers
818 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
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 18 points 4 months ago (19 children)

Good code is self-explanatory. You should only comment your code if it does something unexpectedly complicated.

That being said, it's always a good idea to write a manual, about how to use the code. Don't document how it works, because those who can code will understand it anyways, and those who can't, have no need to understand it.

[–] [email protected] 13 points 4 months ago (11 children)

Hard disagree. It's a lot easier and faster to understand a function that is prefaced with a small line of text explaining what it does rather than trying to figure it out yourself.

It's not about whether you can understand the code or not, it's about efficiency and clarity.

[–] [email protected] -1 points 4 months ago

If done right, the "what it does" is in the method name. If your method is too complicated to summarize in its name, chances are good you should split it up or extract parts of it.

load more comments (10 replies)
load more comments (17 replies)