HACKER Q&A
📣 reconnecting

Comments in Code. Yay or Nay?


Do we still need to maintain comments in general-purpose scripting language? Is good code code that doesn't need comments? What are the most useful comments in code that you've seen?


  👤 eschneider Accepted Answer ✓
Comments are a gift to future you. When you pick up the code again after 6 months/years/however-long-in-the-future and it looks like something you've never seen before, the comments you left should be notes you need to build context around what's in the code and (sometimes more importantly) what's NOT in the code.


👤 Bender

    # If you see this comment after 2008 something went wrong.  rewrite this "temporary script".
I give people an excuse to get rid of my temporary things.

👤 JohnFen
Comments are essential. The code may tell you the "what", but you need the comments to tell you the "why".

👤 chrism238
Still? Why, what changed?

👤 petabyt
I can't stand people who say that all code comments are bad.