Tuesday, March 21, 2017

Ever Wonder Why Commenting Every Piece of Code You Write is Important?

I am trying to figure how some JavaScript I wrote  several years ago for the ScopeRoller website works.  Not enough comments, and I don't remember what tools I used to debug this with.  Some browser with built-in debugger?


  1. Every modern browser has built-in devtools. You can usually bring them up by right-clicking anywhere in the page, selecting "Inspect" or "Inspect Element" from the popup menu, and then looking for a tab named "Source" or "Debugger".

  2. A VERY long time ago one of the first programming books I read said to comment as if you would wake up with amnesia tomorrow because in six months it would be exactly the same.

  3. No, your code should be self documenting. If you feel the need to comment your code, rewrite it to be more clear. Comments are a form of code duplication. They will get out of sync and will be wrong.