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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.
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.
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.