At my first real job I was hired by a couple of OCDers who wanted me to always write code like this:
/* comment describing what the next few lines do */
a line of code
a line of code
a line of code
/* comment describing what the next few lines do */
a line of code
a line of code
a line of code
etc.
The idea was that it should be possible to gain a relatively good understanding of what the code does by reading through the comments, completely disregarding the actual code. For this to work there were some additional rules, for example that code comments always had to begin with a verb, etc.
So, I learned to program this way, and I thought it was cool. Unfortunately, this led to many WTF situations, like the following:
function int foo( int x )
{
/* preconditions */
assert x > 0;
/* change state */
this.x = x;
/* return same value to enable fluent style */
return x;
}
At jobs that I did after that, people either looked at my coding style and did not say anything in order to avoid insulting me, or, if they felt friendly enough to give me advice, they told me that this style of commenting was moronic.
Furthermore, other programmers did not feel obliged at all to follow my style of commenting, so when someone else amended my code, their complete disregard towards my comments was often tantamount to subversion, for example:
/* return same value to enable fluent style */
notifyTheWorldThatXHasChanged();
return x;
So, in my experience, in most workplaces out there, this style of commenting tends to be frowned upon.
My advice would be to write self-documenting code and follow the "minimal comments" rule, which means only add a comment if it is necessary. Comments in code should only be needed in exceptional circumstances, and their presence should alert the reader that there is something extraordinary going on.
When is a comment necessary? When a reasonably careful reading of the code does not reveal what the code does, or why a certain thing is done in a particular way.
What should be considered a reasonably careful reading of the code? It is when you focus all of your attention to reading the code, with an honest aim to understand what it does, but you trust that the code actually does what it appears to aim to do, so you are not actually going through the pain of executing the code in your mind, trying to figure out what it really does, as if the code has ulterior motives. You should only have to do that when debugging code.
Of course, the trick is to write that elusive self-documenting code which, when you look at it, its aim becomes readily obvious. I like to believe that what we do is mostly a science, but this particular little bit seems more like an art to me. An art well worth mastering.