3 ms·
> Someone (I think uncle bob) said that good code is self-documenting, which is bs in 95% of the cases Agreed. For example, comments about Why-do-this, and Why
by KajMagnus 6y ago
> Someone (I think uncle bob) said that good code is self-documenting, which is bs in 95% of the cases
Agreed. For example, comments about Why-do-this, and Why-Not-do-that can be necessary, even if the code shows what happens.
Imagine you're in a taxi, and it suddenly takes the wrong turn, now instead heading towards Surprise-City. Then — you know what is happening. You're going to Surprise-City.
But would't you also want to know Why?
So then it's nice if the taxi driver explains Why: "I buy milk to kitten."
I think the 'Linux kernel coding style' explains comments pretty well:
https://www.kernel.org/doc/html/v4.10/process/coding-style.html#commenting https://www.kernel.org/doc/html/v4.10/process/coding-style.h...