tag:blogger.com,1999:blog-6959582839690958035.post4809801397314527626..comments2023-09-15T11:15:54.222-04:00Comments on public void Life(): A Case Against Commentstesthttp://www.blogger.com/profile/09609860522747123959noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-6959582839690958035.post-65968500886038670732017-09-13T13:42:34.171-04:002017-09-13T13:42:34.171-04:00I agree with the premise, but I disagree with the ...I agree with the premise, but I disagree with the characterization that comments and code tell the same story.<br /><br />To me, comments are like annotated religious texts. You find in one column the actual text, then immediately following in the adjacent column, you find a modern elaboration of the meaning, with cross-references to other relevant information. http://skepticsannotatedbible.com/gen/1.html<br /><br />Written well, comments clarify the intent. But, it's damn hard for the programmer writing the code to context switch into a mode where she can clarify her intent. Religious texts only became annotated hundreds of years after they were written, and here's where I circle back around to agreement:<br /><br />Write the code first, forget comments. When you, or anybody, comes back to that code, and you read it and have a WTF moment, take time to refactor, don't comment. Repeat until you have a WTF moment but can see no other way to refactor. Then comment.<br /><br />This strategy relies on comments as a last ditch, archaeological effort to explain what's going on.Bishop Bhttps://www.blogger.com/profile/07949333992560069648noreply@blogger.com