5 ms·
> You need to use comments to explain the code – Code should be able to explain itself and should be in a format that is easily readable. No thanks. Has this a
by WilliamLP 17y ago
> You need to use comments to explain the code – Code should be able to explain itself and should be in a format that is easily readable.
No thanks. Has this author ever written any algorithm more complicated than a basic CRUD app? I'd like to see him read some kind of well written complicated graphics algorithm without any comments. The "why" is often really really important, and you can't read that from the instructions.
- ggruschow 17y agoAre little ASCII comments mixed in with code the best way to explain a complicated algorithm?
- scott_s 17y agoAlgorithm, no. Details of the implementation, yes. Some implementations require subtle things that aren't obvious unless you're mired in the details. It's nice to have reminders why, say, this particular value needs a +1.
- nollidge 17y agoAgreed. Moreover, certain "why"s like "why's this here instead of over in this class?" or "why is this bit of code repeated?" can't necessarily be explained by refactoring. And sometimes there's just certain technical limits you just can't get around, and you have to comment those.