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