Add comments that explain the reasoning behind non-obvious code decisions, technical constraints, or complex logic, while avoiding over-documentation of self-evident functionality. Focus on the "why" rather than the "what" - document implementation choices that future developers (including yourself) might need to rediscover.
Add comments that explain the reasoning behind non-obvious code decisions, technical constraints, or complex logic, while avoiding over-documentation of self-evident functionality. Focus on the “why” rather than the “what” - document implementation choices that future developers (including yourself) might need to rediscover.
Examples of good rationale documentation:
Avoid over-documenting obvious boolean returns or simple getters. Instead of “// Returns: true if successful, false otherwise”, prefer concise descriptions like “// indicates the operation succeeded” when the return value needs explanation at all.
Enter the URL of a public GitHub repository