Post

Programming Wisdom
Programming Wisdom@CodeWisdom·
“Good code is its own best documentation. As you're about to add a comment, ask yourself, 'How can I improve the code so that this comment isn't needed?' Improve the code and then document it to make it even clearer.” - Steve McConnell
English
20
567
1.3K
0
Ivan Babak
Ivan Babak@sompylasar·
@CodeWisdom Comments are still useful when they answer *why* the code was written, or I'd say designed like that.
English
0
2
27
0
João Carreira
João Carreira@jptcarreira·
@CodeWisdom Can be true, but only in very generic algoritms. I always recommend to not comment what you code, but witch problem are solving.
Lisbon, Portugal 🇵🇹 English
1
1
3
0
Shawn Hartsock ☁️
Shawn Hartsock ☁️@hartsock·
@CodeWisdom I used to believe this. Then I worked with enormous code bases left by people of varying skill. The people who try to practice this usually aren't the ones who are good enough to do it properly. They miss the point that this philosophy still says to make a comment.
English
0
1
2
0
John Stevenson - we live and die together
@CodeWisdom @AmelieCornelis How do you convey the thought processes that went into choosing that approach in code? How do you convey the decisions not taken and the reasons they should be avoided? Code should have clarity, however it's a snapshot of a thinking process by one or more humans over time.
English
1
0
4
0
Maxime
Maxime@webdif·
@CodeWisdom This assumes everyone is mastering the programming language or framework the code uses. This is not true. Comment as always as possible to facilitate the learning of newcomers on the project.
English
1
0
4
0
Haris Iqbal
Haris Iqbal@haris_3301·
@CodeWisdom At time you need to find the middle ground between making your code understandable, and hurting efficiency. IMHO, that's when comments come in. :) #Programming #Wisdom
English
0
0
1
0
Chris Dunne
Chris Dunne@_chrisdunne·
@CodeWisdom Or you could improve the code instead of documenting the improved code instead of commenting it
English
0
0
1
0
Shawn Hartsock ☁️
Shawn Hartsock ☁️@hartsock·
@CodeWisdom Fundamentally, what do you *think* code is? It's a document passed from a human to a machine. Or from a human to other humans. It is instructions. Why would you have to document that? At precisely the point where code escapes that context. And it does that. Like right now.
English
0
0
0
0
Björn Kimminich
Björn Kimminich@bkimminich·
@CodeWisdom I prefer executable specs and unit tests to document the *why?* and comments mostly just to prevent *wtf?* from others and myself later.
English
0
0
0
0
Chris Rothenberger #KingofSeas
@CodeWisdom The more I work in the real world, the more I realize that this is a "perfect world" quote. If it takes an hour to do it right, but 10 minutes to do it quick and comment why, then that's the way you gotta go.
English
0
0
0
0
Estrogenuine Vagueness
Estrogenuine Vagueness@Gen_Vagueness·
@CodeWisdom I was going to say you should have comments anyway, but I guess the end part covers that still, it may bear repeating
English
0
0
0
0
Paylaş