
Renames: A High-Leverage Small Refactor
A misleading name installs a false belief in the people who read it. Which names to fix first, what a name owes at each scope, and the references your rename tool will not follow on its own.
TL;DR: A rename costs seconds and pays every future reader, which makes it a high-return choice among minute-scale refactors. The catch is that not all renames are equal work: a local variable is a keystroke, while an exported symbol consumed outside your codebase is a migration wearing a rename's clothes. This article covers which names to fix first (the ones that lie), what a name owes its reader at each scope, the reach check for the references tooling will not follow on its own, and where vocabulary consistency stops being a rename and starts being a coordinated effort.
Why names dominate readability
Robert C. Martin writes in Clean Code that "the ratio of time spent reading vs. writing is well over 10:1," and a name is read every time the code is. That asymmetry is what makes renaming such good value: the improvement takes seconds, and the saving is collected by every person who reads the identifier afterwards, including you later, when the context has fallen out of your head.
A name is also documentation that cannot drift out of sight. A comment sits where it was written; a design document sits in a wiki nobody opens; a name is present at the declaration and at every call site, so it explains itself in the exact place the reader needs the explanation. That is a structural property, not a matter of discipline — you cannot forget to consult a name.
Which is why a misleading name is worse than a vague one. A vague name — data, result, temp — is honest about telling you nothing; the reader knows to look at the body. A name that claims something false installs a belief the reader carries into their change, and the resulting bug is written confidently, because the author was working from what the code told them.
// The name promises a check. The body performs a write.
function validateSession(session) {
if (session.expiresAt < Date.now()) {
session.expiresAt = Date.now() + SESSION_TTL_MS; // silently extends
persist(session);
}
return session.isActive;
}A caller reads that as a predicate and reasons about it as one. Renaming is a first-class operation in the refactoring catalog: Change Function Declaration, whose aliases include Rename Function, covers a function like this one, and Rename Variable covers variables. Fixing this name — to something like refreshSessionIfExpired, or better, splitting the two behaviors apart — removes a false belief from every reading of every call site at once.
What to rename first
Three categories are worth prioritizing, in this order.
Names that lie. The function that does more than its name admits, like the example above; the function whose name hides work it already does, so callers repeat that work defensively; the variable whose contents changed during a past refactor while its name stayed behind. userList that now holds a map, isEnabled that now carries three states, totalPrice that excludes tax — each one is an active trap, and each is cheap to disarm.
Names that require tribal knowledge. Abbreviations only the original author can expand, and internal project codenames that outlived the project. If a new colleague has to ask what pcm means, the name is charging every newcomer a question, and the answer is not written down anywhere durable. Established domain abbreviations are fine — those are vocabulary, not riddles; the test is whether someone new to the codebase but familiar with the domain can expand it.
Inconsistent vocabulary. Two names for one concept, or one name for two concepts, within a module. When customer, client, and account all appear, the reader must work out whether the difference is meaningful — and cannot, without reading all three implementations. Ambiguity like this costs more than an ugly name does, because it makes the reader distrust every distinction the code draws.
What a good name owes the reader
Intent over mechanics is the first obligation. The name says what the thing means to its caller, not how it is produced. sortedByCreatedAtDescending describes an implementation that will drift; mostRecentFirst describes the guarantee the caller depends on and stays true through a rewrite of the sorting.
Precision should be proportional to scope, a heuristic that helps settle arguments about name length. A three-character name inside a three-line loop is fine — the reader can see the declaration and every use in one glance, so the context supplies the meaning. A module-level name is read far from its declaration and needs to stand alone. A name on a public API surface is permanent in a way the others are not: it appears in code you will never see, it shapes how consumers think about your system, and changing it later costs coordination. That is where the longest deliberation belongs, and it is entirely rational to spend real time on it.
Length follows from that rather than being a value in itself. The right name is as long as it needs to be to be truthful, and brevity that costs precision is a poor trade anywhere beyond local scope. calculateInvoiceTotalWithTax is not too long if the codebase also has a total without tax; it is exactly long enough to be unambiguous. Conventions about casing and word separators are context you follow, not a subject to litigate — whatever the surrounding code does is the right answer.
Rename mechanics, safely
For identifiers that stay inside the codebase, the language server or IDE rename is the default tool, and it is meaningfully better than a text search. It understands scope, so it renames the references that belong to your symbol and leaves alone the identically-spelled identifier in an unrelated module — skipping the false positives a text search would have hit.
What a symbol-aware rename does not follow on its own is the set of places where the identifier's name has escaped the type system. Some IDEs offer optional searches beyond resolved references — as of Nov 2026, IntelliJ IDEA's Rename dialog for a field has options you can enable to also look for the name in comments and string literals in source files and in non-source files such as text, properties, HTML, or documentation files, with a preview before changes are applied — but those are occurrences of the name, not resolved references, so review each one. Before renaming anything beyond a local, check for these:
- Serialization keys, where a field name is written into stored JSON or a message payload and read back by name.
- Database columns and query strings, including any raw SQL that names the column as text.
- API request and response fields consumed by clients you do not compile.
- Reflection, dependency-injection tokens, and dynamic property access, where the identifier appears as a string at runtime.
- Configuration files, environment variable names, and feature-flag keys derived from the symbol.
- Logs, metrics, and dashboard queries keyed on the old name, which will silently stop matching.
None of those is guaranteed to produce a compile error. A missed one can surface as a runtime failure, or worse, silent data loss on a path review does not exercise.
The public surface deserves its own category. Renaming an exported symbol that consumers outside your codebase depend on is not a rename; it is a migration. The path is to add the new name, keep the old one working as an alias, mark it deprecated, give consumers a window, and remove it later — a well-established pattern covered in the article on expand-contract migration, and firmly outside a single commit's scope. Recognizing which side of that line a symbol sits on before you start is what keeps a five-minute improvement from becoming an unplanned breaking change.
One review convention makes rename commits cheap for everyone: keep them mechanical and separate, and say so. A commit that does nothing but rename one symbol lets a reviewer verify the rule once — old name to new name, no behavior touched — instead of reading every occurrence. The same rename woven through a logic change forces them to check each hunk for a smuggled edit.
Vocabulary consistency as a codebase asset
A worthwhile rename campaign is not about any single name; it is about the codebase saying one thing one way.
When the code expresses the same concept three ways, every reader pays a standing translation tax, and every author has to decide which of the three to use next. For names that stay inside the codebase, aligning on one term is a large diff and a small risk — mechanical, tool-assisted, and reviewable as a rule — and it removes that category of ambiguity from the code it touches.
The larger version of this is aligning code vocabulary with the language the domain actually uses. Where the business says "shipment" and the code says "delivery record", every conversation between the two carries a translation step, and translation steps are where misunderstandings accumulate. Ubiquitous language, Eric Evans's term from Domain-Driven Design, names the practice of building up a common, rigorous language between developers and users. That language should be based on the domain model used in the software, and Evans stresses that the language and the model should evolve as the team's understanding of the domain grows. The aim is one term, used by the code and the people, meaning the same thing in both.
The honest limit is scope. Vocabulary alignment beyond the code you are touching becomes a coordinated effort — it needs agreement about which term wins, and it touches files other people have open. At pull-request scale, the achievable and genuinely valuable win is consistency within the module you are already in, plus a note about the wider inconsistency for whoever takes it on.