Don’t repeat code logic in the comments.

Logic should appear in only one place.

Keep it DRY: don’t repeat yourself.

Comments should explain why, not what or how. If the reader needs to know what the formula is for this code, they should look at the source code, not the comments. If they want to know why that algorithm was chosen over some other, then they should find that answer in the comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: