HN2new | past | comments | ask | show | jobs | submitlogin

Yeah, I followed that advice at one point. But I find in practice a plain English comment can be much more helpful than a function name. For example, from the code I linked:

# Check too many lines. Count number of lines without a comment.

If I were to turn that into a function name I would either have one long ass function name or (more likely) I would cut out several words and lose a lot of readability and clarity.



countLinesSinceComment() too long for you?


I think it's a bit too long, yes. I prefer around 10-15 characters for function names. Also, you've lost a lot of readability with that camelCase. Also, the "Check too many lines." part wasn't superfluous -- I had a separate check for too many total lines before I count the number of lines without a comment -- and that part of the comment has been lost.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: