4 ms·
> great code is well documented so that anyone who hasn’t been part of the evolution, trial & error process and requirements that led to the current status can
by billti 5y ago
> great code is well documented so that anyone who hasn’t been part of the evolution, trial & error process and requirements that led to the current status can be productive with it.
Just the other day I was doing a code review where the code itself didn't have a single comment in it, yet the PR had several notes for the reviewer around why something was done a certain way, the failed approaches, unexpected behavior they had to workaround, etc.
My response, "Please put all this information into comments in the code so the next person to work on it doesn't have to figure all this out again".
If code was tricky enough that it took you down several unexpected paths to get a few lines right, take the time to note that in the code for the next poor soul to work on it. (Which may well be yourself in a few months when all those lessons are forgotten).