Skip to content

Comments as Deodorant

Read the need for an explanatory comment as a diagnostic signal, not a virtue — a clear paragraph explaining a confusing function masks a retirable design problem instead of fixing it, so do the rename or split that retires the comment rather than maintaining it.

Core Idea

Comments as deodorant is the maintainability pathology in which a comment is used to explain confusing code rather than to fix its confusingness — masking a design problem instead of retiring it. The prose makes the smell locally invisible to review, leaves the underlying structure (poor naming, mixed responsibilities, a magic number) fully exposed to future change, and muffles the very confusion that would have triggered a refactor. It is maintenance debt, not retirement: unsynced, untestable, non-propagating. Named in Martin's Clean Code and Kernighan and Plauger's The Elements of Programming Style.

How would you explain it like I'm…

Spray Instead of Clean

Imagine your toy box is a big jumbled mess, and instead of tidying it, you stick a note on it explaining where everything is hiding. The note helps a little, but the mess is still there. And if someone moves the toys, the note becomes wrong.

Explaining Instead of Fixing

Programmers can write notes in their code called comments, which the computer ignores. 'Comments as deodorant' is when someone writes a long comment to explain confusing code instead of fixing the code so it's clear. The comment helps the next person for now, but it hides the real problem. The computer can't check whether the comment is still true, so as the code changes the comment can become wrong. The better fix is to rename things, split the code into simpler pieces, and then see if a comment is even still needed.

Comments Masking Design Flaws

Comments as deodorant is a code-maintenance problem where a comment is used to explain confusing code instead of fixing what makes it confusing. A programmer writes a clear paragraph describing a tangled function, which looks like good documentation, but the real issues, such as bad names, a function doing too many things, or mysterious numbers, are still there. The comment does help today's reader, but it cannot be tested or checked by the compiler, and it easily drifts out of date as the code changes. Worse, it hides the smell: code that would have looked like it needed cleaning up now looks acceptably documented, so nobody refactors it. The fix is to rename, split functions, or pull out named constants until the comment is unnecessary, then see if any comment is still needed.

 

Comments as deodorant is a maintainability pathology in which a comment explains confusing code rather than removing the confusion, masking a design problem instead of retiring it. The comment has local value but is maintenance debt: it must be manually kept in sync, cannot be tested, type-checked or compiler-enforced, does not propagate warnings to callers or other use sites, and does not catch the next instance of the same confusion. Three mechanisms make it harmful: it hides the design problem from review, since documented code reads as acceptable; the underlying confusion remains exposed to every future modification, while the comment drifts out of date with no forcing function; and it suppresses the refactor, because the smell that would trigger refactoring is the confusion itself, which the comment muffles. It is described in Martin's Clean Code and Kernighan and Plauger's The Elements of Programming Style, and functions as a meta-level smell — a response to other smells. The remedy is structural: rename, split functions, introduce abstractions or extract constants, then reassess whether any comment remains necessary.

Scope of Application

The concept lives across the code-quality and maintainability subfield of software engineering, recurring scale-invariantly wherever a checkable surface exists to push prose onto.

  • Comments compensating for poor naming — the textbook case, retired by a self-describing rename.
  • Docstrings compensating for mixed responsibilities — a "does A then B unless D" header, retired by splitting the function.
  • Magic-number comments — sleep(86400) # one day, retired by extracting a named constant.
  • Warning comments for unsafe coupling — "don't call before init()" that a type or API should enforce.
  • Dense regex/SQL one-liners — propped up by prose, candidates for decomposition.
  • README- and wiki-as-deodorant — long docs mapping to an architectural refactor never done.

Clarity

Naming this pattern inverts the intuition that more comments mean better code. It reframes the need for an explanatory comment as a diagnostic signal — evidence of an unretired design problem, not good practice — and shows the comment actively conceals the confusion by making the fragment read as documented and acceptable. It also sharpens two distinctions "documentation" blurs: what comments (usually deodorant) versus why comments (legitimate), and the checkable surface (compiler, types, tests) versus the human-only surface.

Manages Complexity

The maintenance pathologies covered look heterogeneous — drifting comments, obsolete rationale, propped-up one-liners, must-read READMEs — across scales from a variable to an org wiki. The pattern collapses that spread to one diagnosis (an explanatory overlay on a retirable structural problem) and one intervention family (do the structural fix, then re-evaluate what prose remains). The analyst tracks one axis per passage — is load-bearing information on the checkable surface or the human-only one — and reads the prescription off it by branch.

Abstract Reasoning

The pattern licenses diagnostic-from-need reasoning (read the presence of prose as a symptom of unretired structure), surface-classification (sort where a change's maintenance cost lives, resolving what-versus-why by branch), interventionist reasoning (a single fixed remedy family, predicting the comment shrinks as structure absorbs it), and meta-level boundary-drawing that fixes this as a response to other smells, recurring identically at every scale.

Knowledge Transfer

Within software engineering the pattern transfers as mechanism across scales, the diagnosis being scale-invariant — from a variable comment to an org wiki to an incident post-mortem, the diagnostic, surface classification, what-versus-why test, and remedy family all carry intact. Beyond software it is a shared abstract mechanism strong enough to be its own candidate prime, explanatory_overlay_masking_structural_debt, with genuine co-instances in law, organisations, pedagogy, and bureaucracy. The software cargo — the compiler/type/test surface, the concrete refactorings, the Clean Code lineage — stays home; carry the parent, not this name.

Relationships to Other Abstractions

Local relationship map for Comments as DeodorantParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Comments as DeodorantDOMAINPrime abstraction: Explanatory Overlay Masking Structural Debt — is a decomposition ofExplanatory Ove…PRIMEDomain-specific abstraction: Code Smell — is a kind ofCode SmellDOMAIN

Current abstraction Comments as Deodorant Domain-specific

Parents (2) — outgoing typed relations

  • Comments as Deodorant is a kind of Code Smell Domain-specific

    Comments as Deodorant is the meta-level code smell in which explanatory prose suppresses the visible trace that should have triggered structural investigation and refactoring.

  • Comments as Deodorant is a decomposition of Explanatory Overlay Masking Structural Debt Prime

    Comments as deodorant is the code-specific case where an explanatory overlay makes structural confusion locally tolerable and delays its repair.

Hierarchy paths (7) — routes to 7 parentless roots

Neighborhood in Abstraction Space

Comments as Deodorant sits in a sparse region of the domain-specific corpus (64th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.

Family — Unclustered & Miscellaneous (2769 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-10-25