I've written a whole project and the code:comment ratio must be like 99:1 ..! It's not deliberate but the code has turned out very readable so commenting it wouldn't be anything more than a waste of time
I only really comment cryptic bits of code - ones that aren't blatantly obvious as to what their function is.
to a certain degree, I'd definitely agree with that, but sometimes I go back to things and I'm like "what was I smoking when I wrote that?!?!", so I do tend to do a bit of commenting around parts that I think are going to bend my mind later. If it's something that's quite involved and can be used elsewhere, I might write an example of usage as a mini guide on how to use it.
Comment class methods with brief description, parameters and return values, mainly out of habit. Rarely comment elsewhere unless someone else may see it or be using it - if it's confusing logic I'll either rewrite it or dump some commented examples in a .txt somewhere.
If I remember I do, but more often than not I forget to put anything in the code, I then come back a year later and go WTF and it takes me ages to figure out what I did. As I don't code very often now, I get a bit rusty
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.