3 ms·
Do we need comments in our code?
- spacedcowboy 5y agoYou should not be commenting on what the code does, unless it’s atrociously ambiguous, in which case you have bigger problems. You should be commenting on why the code is structured as it is, so that future self/others don’t “optimize” away functionality. Example: reading locked registers which have to be read in pairs, and in a specific order. Example: you have one code block because 98% of the code applies to any of multiple inputs, but if X is sent, then Y is optional and Z is implied Comments are usually for the “why”, not for the “how”, readable code gets you past “how”.