Chapter 5. A PASSING COMMENT
How to Write Code Comments
Comments are free but facts are sacred.
Comments are a lot like opinions. You’re free to make them, but just because you do doesn’t mean they’re right. In this chapter, we’ll spend a little time thinking about the details of writing these things. There’s a lot more to writing comments than you’d think.
Probably one of the first things you learned when you were taught to program was how to write comments. You were told that comments aid the readability of code, and you were probably encouraged to write lots of them. But in this game, we need to be thinking more about quality than quantity. Comments are our lifelines, memory jogs, and guides through code. We should treat ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access