View Single Post
  #21   Spotlight this post!  
Unread 24-02-2016, 13:27
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Thoughts On Comments In Team Code

Quote:
Originally Posted by aeastet View Post
There is no such thing as too many comments. You have to remember that you will not always be there to explain what you were thinking.
Comments that tell what a block of code does are good, as long as they don't get into too much detail. Comments that describe why the code does something are important. Comments that explain how it works at a high level are fine.

But comments that just duplicate the code in paraphrase do not help, and they can actively hurt if they fall out of sync with programming changes.

Quote:
I have never seen code with too many comments. I don't believe that is possible.
I have seen code with too many comments. It was like
Code:
ACHK  EQU *       ; check if ASCII input is a letter
      LDA CNV     ; get the configuration value in the accumulator
      SUB #64     ; subtract 64
      BLT SKIP2   ; skip if less than zero
      ...
The first line's comment is helpful, describing what the routine is intended to do. The rest of the line-by-line commentary adds absolutely no information. It serves only to clutter the source code.