DEV Community


Discussion on: The Importance of Quality Comments

timkeith profile image

Any discussion of comments has to distinguish between comments on function/methods/classes/etc. and inline comments. Inline comments are often code smells -- you should consider whether the code can be written more clearly or extracted into another function that explains the intent of the code.

Adding more lines of comments is overhead, like adding more lines of code. You have to be sure that the cost (of maintaining them and having to read them) is worth the benefit they provide. Don't say things in comments that the code could say or already does say.

Forem Open with the Forem app