Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

An opinionated (and mainly correct) guide to naming

The article presents guidelines for effective naming in software development, arguing that good names improve code readability and reduce cognitive load. It offers practical advice on naming conventions, consistency, and avoiding misleading or ambiguous terms to create more maintainable code.

Background

This is a technical essay on software engineering best practices, specifically about naming things in code — variables, functions, classes, etc. The author, Adam Tornhill, is a well-known developer and author who writes about code analysis and software design. "Naming" is famously one of the two hardest problems in computer science (along with cache invalidation and off-by-one errors). The essay argues that good naming is not cosmetic but a tool for making code easier to understand, maintain, and reason about. It discusses principles like avoiding abbreviations, naming based on intent (what something does) rather than implementation (how it works), and the idea that unclear names often indicate deeper design problems. Readers encountering this piece may benefit from knowing that code is read far more often than it is written, so clarity for future readers (including one's future self) is a primary concern.