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?

3 comments:

Mark Erikson said...

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".

KCSteve said...

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.

Rob K said...

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.