Do you write comments in your code? If you do, that’s awesome, and if you don’t, start adding comments right away. I couldn’t do it all until the code was straightforward boilerplate code or some standard stuff that you write every day. But if it is a complex logic, some condition or group of conditions, then it takes a lot
The post Why Code Comments Are Important? appeared first on Rajesh Dhiman.
Top comments (4)
I disagree wholeheartedly with the fact that complex code should be commented on. Comments in code should only be used for why something was done not what it is or how it works. The what and how should be obvious from the code. If it's so complex that a function needs a comment then it either needs to be refactored or redone. The two principles that should always be followed is: Code should be ETC(Easy to Change) and DRY(Don't repeat yourself). Code that is commented is rarely both of those and excessive code comments violate both of the principles
Comments make code readablility easy and understandable
only if you write not declarative code
Most of the times I think you should avoid comments
Code Smell 05 - Comment Abusers
Maxi Contieri ・ Oct 24 ・ 1 min read