6 ms·
Yeah, I'm of the opinion that if you need a class/method comment to explain what it takes in or spits out, you probably named it badly.
by nollidge 12y ago
Yeah, I'm of the opinion that if you need a class/method comment to explain what it takes in or spits out, you probably named it badly.
- AnimalMuppet 12y agoYes... mostly. I worked with a guy who, for every comment, asked "how can I eliminate the need for this comment?" Usually the answer is to name something better. But sometimes you really need a comment, not because something is named badly, but because, even with the right name, there's something not obvious about it.
- nollidge 12y agoAgree completely, that's why I said "probably" :) EDIT: Comments are useful for explaining things like: 1. Non-obvious side effects 2. Code that's working around a bug in a 3rd party library 3. Code that calls into some non-intuitive 3rd party API 4. Citing your work (e.g. "adapted from stackoverflow.com/blah123") 5. Why you used pattern A instead of the more standard pattern B