Tech
Why Comments Should Explain the Reason, Not Repeat the Decision
A code comment is useful when it adds context that cannot be understood from the code alone. Simply repeating what the code does creates noise without helping the next person make a change safely. The most valuable comments explain why a particular decision was made.
The Code Already Shows What Happens
A comment such as // retry the request three times adds little value when the code clearly contains a loop with three attempts. It duplicates information that can become outdated...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to