Writing Comments
Posted on 24 Jun, 2019
The proper use of comments is to compensate for our failure to express ourself in code.
Inaccurate comments are far worse than no comments at all.
Comments do not make up for the bad code. i.e if you find yourself writing comments for a code that is complex to understand. MAKE IT LESS COMPLEX.
Short functions don't need much description. A well-chosen name for a small function that does one thing is usually better than a comment header.
For example. In this code the comments are not needed because the function name describes what it is doing.
Summary
Until now I thought writing comments is a good practice & we should write comments wherever possible. But know reading it is an eye opener & shocking 😱. I will try to avoid comments now.
PS : I have been reading CleanCode for a while & logging what I learn here.
Last updated