News for hackers. Stuff that matters.
Re:Ask HN: Honest question, comments above or under code? by webmaven on Sunday September 05, 2021 @12:48AM (#28421713)
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't happen often).

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'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/functional tests rather than unit tests.

Re:Ask HN: Honest question, comments above or under code? by bitxbitxbitcoin on Saturday September 04, 2021 @04:36PM (#28418879)
Examples usually have it above.