I would not be so rude to say that comments are an excuse for poorly programmed code, like some people above, and not to say that you do not need them.
It also depends on your editor and how you like to see your code in it and how you want others to do it.
For example, I like to create areas in C #. Regions are called dumped areas of the code, in a sense commented out by code containers. So when I look at the editor, I actually look at the pseudo code.
#region Connect to the database // .... #endregion #region Prepare tables #region Cache tables ... #endregion #region Fix column names ... #endregion #endregion
This kind of code is more readable than everything I know, but, of course, it needs an editor that supports custom folding with names. (e.g. Visual Studio editor, VIM ...). Someone will say that you can achieve the same if you put the regions in the procedures, but firstly, you cannot always do this, and secondly, you need to go to the procedure to see its code. If you just set hotkies to open / smooth an area, you can quickly see the code in it while scrolling and reading text and, as a rule, quickly navigate the hierarchy of regions.
On line comments, it would be nice to write code that self-documents itself, but, unfortunately, this cannot be said in generall. It depends on the projects, its scope and complexity.
As a final note, I fully offer documentation in code using a portable and indepent language , for example, NaturalDocs , which can be created to work with any language around with natural syntax that does not include XML or any special formation (hence the name) , plus it does not need to be installed more than once.
And if there is a guy who does not like comments, he can always delete them with a simple tool. I even integrated such a tool into my editor, and the comments went through a simple click on the menu. Thus, comments cannot damage the code in any way that cannot be fixed very quickly.