re: 10 CODING MISTAKES THAT MAKE YOUR CODE SMELL VIEW POST

FULL DISCUSSION
 

Thanks for sharing. Good article. One thing to add about comments is, it is better to avoid all together unless it's helping with auto generated documentation. Methods/functions should be self explanatory, and as you have pointed out, they should do one thing. In that case, name it accordingly and you wont need comments. E.g rather than calling a function Increment(), if it increases a number by one, better name could be IncrementByOne(). Trivial example but shows the intention.

In my years of development, I've always found comments always confuse developers more than they help as the time they stay in the source code grows. They can rot easily as code changes but devs can forget to remove or update comments. Best to avoid them all together :)

 

Absolutely correct!!
Why need comments if variables and function names explain it all ;)

code of conduct - report abuse