TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

3 点作者 AltonWells超过 3 年前
I write mine above.

2 条评论

webmaven超过 3 年前
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.
bitxbitxbitcoin超过 3 年前
Examples usually have it above.