1) When I'm not all that familiar with the language. This allows me to grok the purpose and actions of code quicker.
2) When the action being performed contains more lines than fit in the screen. Knowing a bit more context going in can make what follows more clear.
For 1, it's a matter of who you intend to read/modify the code after you. For 2, that's probably more a case for splitting that code into multiple functions.
From that, I think comments are best used by poor and great programmers, but the middle of the road may not get much benefit out of them. If you don't know how to split your complex bits of code into multiple chunks, or if you expect most people coming after you to now be as experienced as you, comment.
1) When I'm not all that familiar with the language. This allows me to grok the purpose and actions of code quicker.
2) When the action being performed contains more lines than fit in the screen. Knowing a bit more context going in can make what follows more clear.
For 1, it's a matter of who you intend to read/modify the code after you. For 2, that's probably more a case for splitting that code into multiple functions.
From that, I think comments are best used by poor and great programmers, but the middle of the road may not get much benefit out of them. If you don't know how to split your complex bits of code into multiple chunks, or if you expect most people coming after you to now be as experienced as you, comment.