"blabla comment the why not the what blabla"
An easy answer for every question about commenting code... My problem with that is everyone is talking about the "why" and "what" like they were the same thing for everyone everytime.
It's obviously not the case. When I discover something new (an API, a framework, a new project, a tool...), there is a lot of things that i don't understand or i don't even know about the existence. But after some time, a lot of things become more meaningful. I haven't to lost myself in a code jungle to understand what a class is for.
At first, the "why" and "what" are the same thing, and this thing can be summarized into "?".
After spending some time to learn and understand, the "what" becomes more and more easy to grasp, and finally becomes so obvious that i even forget its presence. As the "what" becomes "clearer", my mind has more resources to ask itself about the "why", and my understanding of the whole architecture becomes more and more complete.
If i put comments in the code at the beginning of my learning time, even if i'm trying to comment the "why" i will comment what more experienced people already consider obvious (they will call it the "what" and say the comment is useless).
Comments written after the bigger wave of the learning curve has been crossed will be both fewer in number and describing a very specific feature of the commented thing (only understandable by those who have reached this level of understanding).
The last thing about this is : i have never lost time reading comments, and they have often reduced my learning time. I have never seen a "too commented" code. I have often read comments that were not useful to me (like everyone), but i never thought "if only i had spent all this time reading comments doing something more useful !". Given the fact that all modern IDE provide ui able to hide big comments, i don't understand why it could be considered bad to write a useless comment.
From a more subjective point of view, i prefer to see a few useless green words in a page of code than a few words indented on an empty white background.
i prefer a useless comment in an obvious part of code than nothing in a 15 pages long dark method....