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.

Ask HN: Honest question, comments above or under code?

3 pointsby AltonWellsover 3 years ago
I write mine above.

2 comments

webmavenover 3 years ago
In general, above the class, function, or method, but if details are needed for individual bits then at the end of the line or below (doesn&#x27;t happen often).<p>However, a lot of commentary goes into tests rather than the code, and there I prefer to use doctests, a literate style that interleaves prose and code. In general, it follows this pattern: tell them what you&#x27;re going to do (ie. prose), do it (code), explain what just happened (prose), and prove it did what you say (test code). Doctests are mostly integration&#x2F;functional tests rather than unit tests.
bitxbitxbitcoinover 3 years ago
Examples usually have it above.