3 ms·
99% of the time when you are writing a single line comment you should instead be either renaming a variable or using the extract method refactoring using some a
by InclinedPlane 14y ago
99% of the time when you are writing a single line comment you should instead be either renaming a variable or using the extract method refactoring using some abbreviated form of the comment in the new name.
For the remaining cases it's more important to make sure that you're documenting the "why" of something in the code. If you find yourself often in the situation where making changes to the code requires modifying the comments to keep them up to date that's a big sign that you aren't writing comments appropriately.
- Evbn 14y agoComputeGeometricMeanPriceChange2YearWindow. There is something to be said for the spacing that comments allow.
- InclinedPlane 14y agoStart there, then continue refactoring and renaming. I've rarely run up against a situation where an unwieldly long name was actually irreducibly so.