When to Write Code Comments
Generally speaking, my advice on this topic would be: Don’t write comments to describe what the code is doing. Code written in an imperative way can be read line by line to determine what processing is being performed. Re-stating the logic or steps of execution in a comment runs the risk of the comment falling out of sync with the code and becoming outdated. If a section of imperative code gets big, unwieldy, and hard to read, that’s probably a sign that a refactoring is needed and some abstractions need to be introduced....