DEV Community

Discussion on: 💻 Documentation as code

Collapse
paddy3118 profile image
Paddy3118

Having code in addition to comments that describe that code is a "Don't Repeat Yourself" (DRY) principle violation.

Comments can be repetitive but don't have to be even if they describe code. They could, for example, name an algorithm being used.

Comments on what is being done rather than the how, can also be of use. especially when code is changed for performance reasons.

Collapse
adamcoster profile image
Adam Coster Author

Yep, definitely! The best comments are those that are least likely to become incorrect when the code changes.