DEV Community

Discussion on: Best Practices for Code Documentation and Comments: A Guide for Budding Programmers

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

I don't think so. The article is about comments, not variable naming. The comments shown here give no more information about the variables' content - they just repeat the name.

Thread Thread
 
montyharper profile image
Monty Harper

The article is about documentation, which encompasses both comments and variable naming. Also, I took each example to be illustrative of a particular point. In point 2, the example went from "bad" to "good" by providing context, while both versions happen to be redundant. In point 4 the example went from "bad" to "good" by removing redundancy. In both cases the code could be further improved by applying both principals. In point 2 the "good" example could be made even better by dropping the comment altogether to remove the redundancy. In point 4 the "good" example could provide even more context with a better variable name (in which case a comment may not be needed), or a more specific comment (occurrences of what?). But I believe the author's intent was to create examples that focus on one issue at a time.

Thread Thread
 
saloman_james profile image
James saloman

Got my point..