Conservative. Idaho. Software engineer. Historian. Trying to prevent Idiocracy from becoming a documentary.
Email complaints/requests about copyright infringement to clayton @ claytoncramer.com. Reminder: the last copyright troll that bothered me went bankrupt.
"And we know that all things work together for good to them that love God, to them who are the called according to his purpose." -- Rom. 8:28
Pages
▼
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?
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".
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.
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.
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".
ReplyDeleteA 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.
ReplyDeleteNo, 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.
ReplyDelete