Completely agreed. Put another way: the sentiment that code documents itself is only possible in purely logical systems with no edge cases or surprising consequences.
As an example, our code base has a comment which refers to our internal issue tracker which itself refers to this HN comment: https://news.ycombinator.com/item?id=9048947
It's also only possible if the code is thought of as a text and is proofread/edited rigorously for reading. My process is
1) write the code quickly- add comments
2) revise for clarity and efficiency (usually modularity), remove comments as confidence allows. This is where I might get the variable and method names correct for self-documenting code. Usually it takes several passes. But most often, "good enough is good enough" and I leave comments in. Just in case.
Re:Avoid Else, Return Early (2013)
by vanderZwan on Monday March 26, 2018 @12:14PM
(#16679959)
> which itself refers to this HN comment
I was secretly hoping you actually meant your own comment, creating a recursive loop. But a surprise John Nagle is even better
Re:Avoid Else, Return Early (2013)
by jakobegger on Monday March 26, 2018 @10:01AM
(#16678927)
Also, any non-trivial software project is going to end up needing workarounds for bugs in other software. And you really need to document those. Because otherwise someone is going to remove that second refresh() statement, not knowing that this works around a bug in OS version xyz.
Re:Avoid Else, Return Early (2013)
by vanderZwan on Tuesday March 27, 2018 @05:51AM
(#16686798)
Basically, "IE8 fix"-comments
Re:Avoid Else, Return Early (2013)
by RussianCow on Monday March 26, 2018 @05:01PM
(#16682557)
> There is a ton of code that only exists because of issues elsewhere in the code.
Or sometimes, not even that: issues elsewhere in the system, possibly completely outside of your control (e.g. the language/framework/library you're using, the OS, business requirements, etc).
Clear, self-documenting code is great but it can't capture that holistic insight into what the whole program is doing. It can't capture context, because the whole point of clean refactored code is to be as context-free as possible.