TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

When to Comment That Code

3 pointsby linusg789about 2 years ago

1 comment

nabbe23about 2 years ago
There are certainly times when comments are important and appropriate (C code is probably a great example) - but I find myself more often than not struggling to understand if an existing comment is truly up to date (commit history sometimes helps here, but not always.)<p>Instead of commenting, I try to split out functions or variables that specify the intent. Since it&#x27;s code - it must be up to date.<p>An example from this article would be:<p>assert(ep.send == null); &#x2F;&#x2F; TODO: support multiple senders<p>Turning into<p>assert(notMultipleSenders(ep.send));