A time and a place for comments

| 0 Comments

I'm fairly set in my ways about the value (or lack of) of comments in C++ code. I tend to have very few comments in my code and I tend to favour names and structure over comments; names and structure compiles and doesn't lie. Sometimes I go too far in that direction and I'm forced to fight with some of my old code and at that point I might add a comment that explains the non obvious but I'm more likely to attempt to refactor the code into something where the names and structure tell the story better.

However... I have a hobby project which involves writing embedded assembly language. I haven't done much serious assembly language programming and it's always been on my list of things to do... Anyway, it seems to me that, in general, the time and place for comments is in assembly language... The scope for telling the story with names and structure is so much less in assembly that comments are far more important. Perhaps I'm just not fluent enough that I can tell the tale with names and structure, but it seems to me that the more expressive your language and the more explicit your coding style the less there is a need for comments...

Leave a comment