3 ms·
I treat the comments in my code as notes... things future developers will need to know, TODO's, occasionally why I'm doing things a certain way, or other things
by lojack 10y ago
I treat the comments in my code as notes... things future developers will need to know, TODO's, occasionally why I'm doing things a certain way, or other things that may be forgotten. I try to make the code as readable as possible so comments aren't needed. If you really want the documentation, look at the tests. My test descriptions describe what the code should be doing. The actual tests describe the API. Then there's actual documentation. This tends to cover more high level stuff. If the code provides an API others will be using then I'll provide documentation on how to consume it, otherwise my tests describe the API.
All of that being said, I'm not dogmatic about any of the above. I'd prefer my code to be self-documenting, but I understand it isn't always for any number of reasons.