[racket] Why experienced programmers don’t use comments?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Tue Jul 9 07:34:26 EDT 2013

On Mon, Jul 8, 2013 at 9:41 PM, Ben Duan <yfefyf at gmail.com> wrote:
> Dear All,
>
> I have a question here. There’s an extensive use of comments in HtDP. But
> there are few comments in experienced programmers’ code, for example in
> racket’s source code. Why is that?

I think the claim about experienced programmers code is incorrect.  In
Typed Racket, the code I'm most responsible for, more than 10% of the
lines of code have comments on them, and there are other places where
the code itself is written to include its specification, such as using
contracts.

Certainly, there are parts of the code that are under-commented.
Mostly these are places where the needed comment is an in-depth
explanation of design decisions, or discussion of the implementation
choices behind a particularly tricky bit of the system.  These aren't
the kinds of comments that HtDP focuses on, but that doesn't make them
any less necessary.  Unfortunately, they're often easy to leave out in
a hurry to get something done.

Sam


Posted on the users mailing list.