Sunday, August 31, 2014

Comment, Comment, Comment

A pencil writing on lined paper as a reminder to write comments in your code.
~ Add Comments to Your Code ~
I was concerned that too many comments in code would slow down the code so I did a little Internet research.

This is what I found.

The short version: comment, comment, comment.

The long version. Code that has 1,000,000 lines in it will load slightly slower than code that has 10 lines in it. We're dealing with microseconds here. You can get ridiculous and split hairs down to the 0.00000001th of a second or you can get on with life. There are so many other factors that come into play when running code that your comments won't even make a dent compared to the other stuff.

In my reading I often came across coders inferring that not commenting your code was a greater sin and a sign of shoddy, unprofessional code.

Code comments are notes to yourself and others that may be helpful. The value of those notes far outweighs any infinitesimal performance hit they may cause.



About Comments
Be civil and show some class toward your fellow commenters.

Trolls will be ignored as will posts containing swear-words or alternate spellings of swear words.

No comments:

Post a Comment