re: I love to document my code. Am I doing it wrong? VIEW POST

re: Hey Alcher, thanks for the code sample. I'm not too sure about it violating DRY principle since the code itself and the comment serves for differ...

If the comment really helps you in this case, why don't you make the code more like the comment?

int age_of_user; or
int age_of_current_user;

That is the better way, in my opinion, since the comment is not necessary and therefore you cannot forget to change comment when the code changes.

"When you feel the need to write a comment, first try to refactor the code so that any comment becomes superflouus." - Martin Fowler

code of conduct - report abuse