5 ms·
I find it good practice to comment code for that other guy that is me-in-two-months. I just rediscovered some semi-old code and boy am I happy about the comment
by quchen 13y ago
I find it good practice to comment code for that other guy that is me-in-two-months. I just rediscovered some semi-old code and boy am I happy about the comments.
- dragonwriter 13y agoYeah, good comments help support DRY. Not so much DRY in the code, but avoiding repeating the mental work that led to the code (whether yours or somebody else's.) If the code is non-trivial, there is probably research, discussion, or analysis that went into producing it that the next person working with the code (whether you-in-N-months or someone else) either won't have done or won't have as fresh in their mind when they look at the code. Summarizing or providing references for that work stops it from being redone (or, worse for the code, the lessons forgotten and the mistake that it avoided reimplemented.)