Comments in Code 116 words published on September 29, 2018.

I’ve had many discussions and heated debates about the use of comments in code. The conversation is usually geared toward looking for a rule. One side argues, “Never write comments, code should be self documenting”, while I’ve seen the other side go as far as to say, “Every block of code needs a comment”.

Fact is, your code should read well. This might mean writting more comments than you want to, or it could mean creating a new function with a descriptive name. If you must have a rule, here it is. Someone should be able to read your code (from top to bottom) and understand what is going on, hopefully getting a taste of why.