View Single Post
  #23   Spotlight this post!  
Unread 24-02-2016, 13:38
GreyingJay GreyingJay is offline
Robonut
AKA: Mr. Lam
FRC #2706 (Merge Robotics)
Team Role: Mentor
 
Join Date: Mar 2015
Rookie Year: 2015
Location: Ottawa, Canada
Posts: 769
GreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond reputeGreyingJay has a reputation beyond repute
Re: Thoughts On Comments In Team Code

Keep in mind that what's obvious to you today, in the heat of the moment, might not be obvious to you a few months from now, or worse, a few weeks from now, inside your pit, frantically trying to fix a bug.

Let alone the next programmer next year who inherits the code.

I agree that wading through "obvious code is obvious" comments are counterproductive.

Use useful variable names.

Use constant definitions wherever possible, and give them useful names. LEFT_SHOOTER_MAXIMUM_RPM is more clear than MAX.

If you have a lot of nested function calls, that you're doing math on, and casting to new types, all inside of a conditional, it helps to break all that out. Store some of the values inside of temporary variables and pass those into the conditional.

Ternary operator ? "Use it sparingly" : "Don't use it"