Readplace

Code Comment Is A Smell ๐Ÿ”Š

medium.com 7 min read
View original
  • Last crawled at
Summary (TL;DR)
Code comments are a code smell because they often reflect poor code readability. Developers are biased toward their own writing, so comments can be misleading. Instead, use code review, pair programming, version control commits, and behavior-driven development (BDD) tests to document intent. Comments are acceptable for counter-intuitive hacks, untestable bug fixes, or as temporary markers in legacy code, but only as a last resort. Public API documentation (JavaDoc/JSDoc) is different and has its own purpose. The goal is self-documenting code.