2021-08-30 - on code comments

recently, while listening to a podcast interview with Brian Kernighan i came across of a great quote from him:

Don't comment bad code – rewrite it.

while i did mumble about code comments in the past, this quote is so good and adequate, yet so condensed, it's worth exploring it a bit:

  • bad code shall not be commented, but rewritten.
  • existing comment may hint you that it might be a bad code.
  • comment does not necessary mean that the code is bad.
  • there are places where comments are needed, as it's hard/impossible to explain it enough in code.

another quite from Brian K. that i love is:

Do what you think is interesting, do something that you think is fun and worthwhile, because otherwise you won't do it well anyway.

here are some more. :)

and remember – by the end of the day, there are only 2, truly difficult issues in IT:

  1. cache invalidation
  2. naming things
  3. off-by-one errors
blog/2021/08/30/2021-08-30_-_on_code_comments.txt · Last modified: 2021/08/30 09:09 by basz
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0