Friday, November 20, 2009

Ugly comments = ugly code

I like the blog entry that Will Kruse found:

http://www.itworld.com/development/84780/if-comments-are-ugly-code-ugly

I associate it with "code hygiene." It basically explains that programming is "detail oriented" and if a programmer isn't willing to take the time to make the comments correct (everything from semantics to syntax to spelling), then chances are they aren't taking the care necessary to make the code correct, either. Lots of evidence of "TODO" items or "Does this work?" comments are an exact indication of code health.

I find this true in the code I write. And it doesn't necessarily equate to the volume of comments. When I really dedicate care to what I'm developing, the quality of the comments tend to reflect the same level of the code quality. (I also tend to be a very pedantic, verbose commenter.) On the other hand, when I slam stuff together, I (being the pedantic verbose type) tend to write long winded comments explaining logic with questions and hints at potential bugs. "Well ... I think this is going to work" and "TODO: finish this," etc.

Interesting food for thought.

No comments:

Post a Comment