10 ms·
Even among experienced developers, assuming for a moment that it is possible to write perfect code that doesn’t require comments... Why is the author talking u
by andreyf 18y ago
Even among experienced developers, assuming for a moment that it is possible to write perfect code that doesn’t require comments...
Why is the author talking under the assumption that "perfect" code wouldn't require comments? I would imagine perfect code to have consistent style, an intelligent and intuitive separation of concepts, etc. I don't see a good reason it should strive to be human readable. Quite the opposite, actually - I find good code will often use mathematical abstractions that simplify the problem greatly, but are nearly impossible to understand, and need extensive comments to explain.
- ajross 18y agoYes, absolutely. Although in the extreme of complexity, comments actually stop helping. A straightforward implementation of, say, RSA or an FFT can actually be done in small, simple, well-organized code whose structure is "obvious" to someone who understands the problem. But no amount of comments is going to help the reader understand the algorithm to begin with. In those circumstances it's much better just to document what you're doing and let the reader go to their textbooks.
- andreyf 18y agoAgreed, references in code ought to be encouraged - no need to copy-paste an entire paper (or chapter of a textbook).