Uncommunicative Name

Names that don’t reveal intent.

“The name should tell you why it exists, what it does, and how it is used.” – Robert C. Martin

Signs of Use (Symptoms)

  • Single-letter variables: d, x, temp.
  • Generic names: data, info, process.
  • Abbreviated names: drctn for direction.

Why it is bad (Consequences)

  • Readability: Reader has to decode meaning.
  • Guesswork: Leads to misunderstandings.

Why it happens (Root Cause)

Faster to type short names. Developer knows what it means now.

When it might be okay (Exceptions)

  • Loop counters i, j in short loops.
  • Mathematical symbols in formulas.

Explanation

Problem

const d = new Date();. What is d? The date of what?

The Flaw

Names should convey meaning. d conveys nothing.

Real world analogy

A filing cabinet labeled “Stuff”. Useless.

Refactoring Solution

  • Rename Variable / Method / Class.

Pros and Cons (of the Antipattern)

Pros (Why people do it) Cons (The price you pay)
  • Faster typing
  • Incomprehensible code
  • Comparison

    • Related Antipatterns: Inconsistent Names.
    • Related Principles: Readability, Self-Documenting Code.

    Code example

    Typescript

    Bad (The Antipattern)

    Good (The Fix)