Comment
Domain: Software Engineering
π― Motivation
Notes in code for humans. Explain why something is done, not what (the code shows what).
π Concrete Example
Good comment: β# Use binary search because the list is sorted - O(log n) instead of O(n).β Bad comment: β# increment i by 1.β The first explains why; the second is obvious from the code.
π Analogy
A comment is like a margin note in a textbook - βThis formula is used in physics.β The note explains why, not what. The textbook (code) already shows what. Comments explain the reasoning behind the code.