News for hackers. Stuff that matters.
Re:When hiring developers, have the candidate read existing ... by jonahx on Saturday April 16, 2022 @12:34AM (#31049521)
>No need to interweave documentation and code, in most cases.

Locality is the reason, and it's a good reason. Of course, I don't want to see paragraphs of explanation inline, but a one-line comment giving context for some choice that might be confusing is much better and faster to work with than a separate WHY doc.

Re:When hiring developers, have the candidate read existing ... by TameAntelope on Saturday April 16, 2022 @01:02AM (#31049630)
It's neither faster nor better, in practice.

It's not faster because you can just name the variable whatever it is the value represents, so by adding a second descriptor (the comment) you're introducing needless complexity.

It's not better because you really shouldn't be changing a value you don't understand the context around, which means reading much more than a one-line comment.

Re:When hiring developers, have the candidate read existing ... by hamburglar on Saturday April 16, 2022 @01:28AM (#31049756)
I think the GP is referring to the very common case where you can’t possibly say what needs to be said in a single variable name, but one or two lines of comments is sufficient.
Re:When hiring developers, have the candidate read existing ... by jonahx on Saturday April 16, 2022 @02:47AM (#31050174)
I am saying things like this:

https://github.com/golang/go/blob/master/src/cmd/cgo/ast.go#...

belong in the source code, not a Why doc. No variable naming can give that context.

Re:When hiring developers, have the candidate read existing ... by TameAntelope on Saturday April 16, 2022 @04:47AM (#31050785)
If you think variable naming is the only tool in the “self documenting code” toolbox, I recommend learning substantially more before dismissing the concept.