DEV Community

Discussion on: Why Code Comments Are Important?

Collapse
 
chri3gabrielsson profile image
chri3gabrielsson

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