====== 2021-08-30 - on code comments ====== recently, while [[https://lexfridman.com/brian-kernighan/|listening to a podcast interview]] with [[wp>Brian Kernighan]] i came across of a great quote from him: > Don't comment bad code -- rewrite it. while i did [[blog:2020:01:11:2020-01-11_-_self-documenting_code|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 [[http://ellard.org/dan/www/libsq/ref/style.html|some]] [[https://www.goodreads.com/author/quotes/153350.Brian_W_Kernighan|more]]. :) and remember -- by the end of the day, there are only 2, truly difficult issues in IT: - cache invalidation - naming things - off-by-one errors