I tend to write detailed doc comments. In a concise language like Ruby, it's very easy for my class and method documentation to end up being longer than the classes and methods they describe.
When i first started writing comments, like 10 years ago, I would comment everything including initializing variables. Now I only note total hacks . So, I lied about NEVER commenting. Maybe one comment for every hundred lines. Except for work, I will comment anything unobvious.
Only in intermediate stages, though. I have a habit of notating a complete snapshot of my current position in the code before I go to sleep, and then erasing parts of it as I fix the code.
Discussion (3)
I tend to write detailed doc comments. In a concise language like Ruby, it's very easy for my class and method documentation to end up being longer than the classes and methods they describe.
When i first started writing comments, like 10 years ago, I would comment everything including initializing variables. Now I only note total hacks . So, I lied about NEVER commenting. Maybe one comment for every hundred lines. Except for work, I will comment anything unobvious.
Only in intermediate stages, though. I have a habit of notating a complete snapshot of my current position in the code before I go to sleep, and then erasing parts of it as I fix the code.