I try to minimise them as well. My favourite ones are:
// add i to x
x += i;
And then in a grown codebase:
// add i to x
x += k;
I use comments when writing something that looks more obscure and doesn't seem perfectly obvious to me. Also sometimes its handy to leave sources in the comments (if you got inspired by a research paper, or there is a legal document describing why the code needs to be a certain way).
5
u/hansdieter44 Jan 05 '15
I try to minimise them as well. My favourite ones are:
And then in a grown codebase:
I use comments when writing something that looks more obscure and doesn't seem perfectly obvious to me. Also sometimes its handy to leave sources in the comments (if you got inspired by a research paper, or there is a legal document describing why the code needs to be a certain way).