
Transforming Code Clarity Through Better Names
Indrajeet Patil

Source code for these slides can be found on GitHub.
🎯 Goal
Transform naming from an afterthought into a deliberate practice.
Despite Python examples, all the mentioned strategies are language-agnostic.
None of this advice is dogma; there can be valid reasons and conventions to break these rules.
- Phil Karlton
Navigating the codebase with good names as beacons of clarity

Multiple cognitive demands exhaust mental capacity, leaving little for naming.

Result: Naming becomes reactive rather than deliberate
The hidden cost of poor naming
Immediate consequences:
Long-term impact:
Poor naming spreads confusion throughout the entire system.
Good names pay dividends
Development velocity:
Maintenance benefits:
Time spent on naming is an investment with compound interest.
“The beginning of wisdom is to call things by their proper name.” - Confucius
Names must serve the reader, not the author, of code.
Good names reveal intention and eliminate guesswork.
Common pitfalls that make names harder to understand
| Tip | Why | Bad | Good |
|---|---|---|---|
| Confusion & Similarity | |||
| Avoid imprecise opposites | Can be confusing | begin/last |
begin/end or first/last |
| Don’t use hard-to-distinguish characters | Look identical with certain fonts | count0, counto |
count_zero, count_letter |
| Don’t use similar names for different meanings | Easily confused, need 2+ letter difference | PatientRecs, PatientReps |
PatientRecords, PatientReports |
| Avoid naming entities with homonyms | Leads to confusion in discussion | waste, waist |
garbage, body_circumference |
| Don’t use easily confused names | Too similar, mistaken identity | nn, nnn |
n_square, n_cube |
| Avoid ambiguous acronyms | Meaning varies by context | NA (North America vs Not Available) |
north_america, not_available |
| Consistency & Standards | |||
| Don’t use inconsistent abbreviations | Choose one prefix and use consistently | numColumns, noRows |
numColumns, numRows |
| Don’t allow multiple English standards | Causes constant guessing | centre, center (mixed) |
center (consistent) |
| Don’t use misleading abbreviations | Conflicts with language conventions | str (for “structure”) |
structure |
| Avoid misleading names | Wrong info is worse than no info | get_means() (incorrectly implies precomputed) |
compute_means() (correctly indicates computation) |
| Tip | Why | Bad | Good |
|---|---|---|---|
| Communication & Clarity | |||
| Don’t use pop-culture references | Not everyone knows them | thats_what_she_said |
female_birdsong_recording |
| Don’t use slang | Can’t assume familiarity | hit_the_road() |
exit() |
| Avoid unintended meanings | Check Urban dictionary | dump() |
export_data() |
| Don’t use uncommon English words | Stick to common parlance | commence_process() |
start_process() |
| Don’t use unpronounceable names | Enables easier verbal communication | genymdhms() |
generate_timestamp() |
| Don’t use region-specific terminology | Prefer international English | lorry_capacity, boot_storage |
truck_capacity, trunk_storage |
| Technical & Maintainability | |||
| Don’t misspell to save characters | Correct misspelling is harder to remember | hilite |
highlight |
| Don’t use commonly misspelled words | Slows you down, increases errors | accumulate variants |
sum, collect |
| Don’t use numeric suffixes for levels | Not informative | level1, level2, level3 |
beginner, intermediate, advanced |
| Don’t use unsearchable names | Hard to find and replace | a, f |
arr, fun |
| Don’t prioritize grammar over clarity | Plural forms aid comprehension | fish (for multiple) |
fishes, peoples, feedbacks |
Actionable strategies for creating clear, maintainable names
Name quality correlates inversely with comment detail needed.
Tip
Good names rarely require readers to read the documentation to understand what they represent.
Generic names are widely used and acceptable in short-lived contexts. However, as scope and complexity increase, specific names become essential for clarity.
For longer loops, use meaningful names instead of i, j, k:
All variables are temporary. Calling one tmp invites carelessness.
Tip
Even when you think you need generic names, you are better off using more descriptive names.
Try to misinterpret candidate names.
Tip
Precise and unambiguous names leave little room for misconstrual.
Find the right level of detail and domain focus—precise enough to be clear, concise enough to be readable, and focused on what rather than how.
Use context to eliminate redundancy:
Avoid encoding implementation details in names:
Find the precision sweet spot:
Tip
Good names focus on purpose, include critical details, and remain meaningful across implementations.
Standards reduce cognitive burden by enabling knowledge reuse across contexts.
Avoid conflicting meanings and maintain consistency:
Follow language and domain conventions:
Use consistent prefixes for IDE tab completion:
Following a standard consistently is more important than which standard you adopt.
Avoid redundancy
classShape, good: Shape)doAddition(), good: add())Tip
If some information is critical to know, it should be part of the name.
Names for Boolean variables or functions should make clear what true and false mean. This can be done using prefixes (is, has, can, etc.).
In general, use positive terms for Booleans since they are easier to process.
Tip
Boolean variable names should convey what true or false values represent.
Select terminology that matches your context: computer science terms for technical concepts, problem domain terms for business logic.
Use computer science terms for technical concepts:
Use problem domain terms for business concepts:

Follow consistent patterns: nouns for entities and data, verbs for actions.
Classes and objects should use nouns:
Class represents a concept and should use singular nouns (e.g. User and not Users).
Methods that return values use nouns, action methods use verbs:
Tip
Grammatical consistency helps readers predict what methods do without reading documentation.
What they CAN do:
What they CANNOT do:
The fundamental limitation
Linters can enforce syntax but not semantics. Good naming requires human understanding of both the problem and the solution.
Why AI tools can help:
LLM-Generated Names
LLMs can suggest overly verbose names or miss domain context, but they can also improve unclear ones. Example: process_data(x) -> calculate_average(sales_data)
Always review LLM-generated names critically.

Lower cognitive load + fresh perspective = ideal conditions for better naming.

Improving names in existing codebases requires careful strategy to avoid breaking changes.
Safe refactoring approaches:
Version control best practices:
"Rename calc_tot to calculate_total"“In your name I will hope, for your name is good.” - Psalms 52:9
For development velocity:
For design quality:
For team collaboration:

Source: Geek & Poke
Invest time in good names early—they pay dividends by reducing system complexity.
The more you do it, the easier it will get!
“Using understandable names is a foundational step to producing quality software.” - Al Sweigart
And Happy Naming! 😊
Check out my other slide decks on software development best practices
McConnell, S. (2004). Code Complete (2nd ed.). Microsoft Press. (pp. 259-290)
Boswell, D., & Foucher, T. (2011). The Art of Readable Code. O’Reilly Media, Inc. (pp. 7-31)
Martin, R. C. (2009). Clean Code. Pearson Education. (pp. 17-52)
Hermans, F. (2021). The Programmer’s Brain. Manning Publications. (pp. 127-146)
Ousterhout, J. K. (2018). A Philosophy of Software Design. Yaknyam Press. (pp. 121-129)
Goodliffe, P. (2007). Code Craft. No Starch Press. (pp. 39-56)
Padolsey, J. (2020). Clean Code in JavaScript. Packt Publishing. (pp. 93-111)
Contieri, M. (2023). Clean Code Cookbook. O’Reilly Media, Inc. (pp. 89-110)
Zimmerman, C. (2024). The Rules of Programming. O’Reilly Media, Inc. (pp. 31-42)
For a good example of organizational naming guidelines, see Google C++ Style Guide.
Various domains have established naming conventions that provide consistency and clarity:
BEM (Block Element Modifier) - CSS class naming methodology
REST API Naming Conventions - Guidelines for RESTful resource naming
PEP 8 - Python naming conventions
Google Java Style Guide - Java naming conventions
Rust Naming Conventions - Rust API naming guidelines
Go Code Review Comments - Go naming best practices
Kubernetes Resource Naming - Cloud-native resource naming
Database Naming Conventions - SQL table and column naming
Microsoft .NET Naming Guidelines - .NET framework naming conventions
Ruby Style Guide - Ruby naming conventions
Programming Language specific
| Language | Variables | Functions | Classes | Constants |
|---|---|---|---|---|
| Scala | camelCase |
camelCase |
PascalCase |
UPPER_SNAKE_CASE |
| Kotlin | camelCase |
camelCase |
PascalCase |
UPPER_SNAKE_CASE |
| Rust | snake_case |
snake_case |
PascalCase |
SCREAMING_SNAKE_CASE |
| Swift | camelCase |
camelCase |
PascalCase |
camelCase |
| Elixir | snake_case |
snake_case |
PascalCase |
@upper_snake_case |
Technology Stack specific
| Layer | Convention | Examples |
|---|---|---|
| Database | snake_case |
user_profiles, created_at |
| REST APIs | kebab-case/snake_case |
/user-profiles, user_name |
| GraphQL | camelCase |
userProfile, orderItems |
| CSS/HTML | kebab-case |
.nav-menu, #main-content |
| DevOps | kebab-case |
my-app-deployment |
| URLs/Routes | kebab-case |
/api/user-accounts, /admin/user-settings |
| Event Names | camelCase/kebab-case |
userSignedIn, order-completed |
Consistency within each layer matters more than uniformity across layers
There are various casing conventions used for software development.
Illustration (CC-BY) by Allison Horst
Illustrating naming benefits for software design using functions as examples
“Do One Thing And Do It Well”
Naming reveals if you’re following this rule.
Warning: Functions with and or or in names likely violate this principle!
Parameter names reveal design problems.
Boolean/flag parameters often signal functions doing multiple things
Insight: If you need a flag parameter, consider splitting into separate functions
Caveat: Flag parameters are acceptable when they modify a single atomic operation rather than switch between different operations (e.g., sort_ascending=True, verbose=False).