F10Beginner

Comment Necessity Review

20 minEvery code review

Format: Check whether comments in the code are valuable.

Comments that are needed:

  • Explaining "why" (reasons behind business logic)
  • Explaining the approach of a complex algorithm
  • Documenting temporary workarounds (why it's done this way + when to fix it)

Comments that are not needed:

  • Explaining "what" (the code itself should be clear enough)
  • Commented-out code (should be deleted β€” Git will remember)
  • Stating the obvious (x = x + 1 // add 1 to x)

My Notes