Two's Complement

Questionable Comments

9 snips
Sep 18, 2023
Ben and Matt explore the purpose and characteristics of good comments in code, discuss the management of to-do comments in codebases, and emphasize the role of comments in thread safety and code understanding. They also outline the risks of leaving commented out code and suggest alternatives like source control and refactoring.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
ADVICE

Avoid Comments with Better Code

  • Write better code to avoid comments.
  • Comments often represent deficits in code clarity.
INSIGHT

Comments as Apologies

  • Comments sometimes apologize for complicated or unintuitive code.
  • They often preface "spooky action at a distance" situations.
ADVICE

Descriptive Variable Names

  • Use descriptive variable names instead of comments like "apply interest rate".
  • Write interest_rate = 1.13 and value_with_interest = ... for clarity.
Get the Snipd Podcast app to discover more snips from this episode
Get the app