Clean Code Series: The Power of Meaningful Names


Is Your Code a Clear Map or an Unreadable Maze?
Most software systems don’t collapse because of missing features. They collapse under their own weight—when the code becomes so tangled it’s nearly impossible to understand, modify, or evolve without breaking something.
How many times, in the middle of a project, have you or a teammate said something like:
“It’s better to rewrite everything than try to fix this.”
Or
“Whoever wrote this is probably not even at the company anymore…”
These comments don’t come out of nowhere.
They’re symptoms of what Robert C. Martin calls the “progressive decay of code”: the natural tendency of every system to move toward chaos unless there’s a continuous effort to keep it clean.
The cost of ignoring code quality is invisible at first—but fatal in the long run.
The truth is: messy code increases maintenance costs, slows teams down, and creates bugs that are hard to fix. But let’s cut to the chase: the solution starts with something fundamental (and often overlooked): choosing meaningful names. It’s the first pillar of code that actually works in the long term.
Clean Code: More Than a Technique — A Professional Act of Respect
Robert C. Martin, in his seminal book Clean Code, defines writing clean code not just as a technical skill, but as an art — a mix of discipline, technique, and, above all, care for those who will interact with that code in the future.
“Clean code is code that has been written by someone who cares.” — Robert C. Martin
When you think about it, the pursuit of clean code is, at its core, an act of respect:
- Respect for your future self: Who will inevitably have to revisit and understand that code months or years later.
- Respect for your teammates: Who rely on code clarity to collaborate, maintain, and add new features.
- Respect for clients and end users: Who count on the system’s stability and reliability.
Adopting clean code practices is an investment in the sustainability of the project and the sanity of the team.
What Defines Truly Clean Code?
Clean code goes far beyond formatting rules or naming conventions. It’s about creating code that is inherently:
- Easy to read: The logic flows naturally, with no hidden intentions to decipher.
- Easy to understand: Another developer (or future you) can quickly grasp its purpose and function.
- Easy to change: Updates and new features can be added confidently, without the fear of breaking something.
Truly clean code:
- Feels like it was written for humans first, and machines second.
- Tells a clear and cohesive story about what the system does and how it does it.
- Avoids surprises, unexpected behaviors, and hard-to-trace “magic.”
- Dramatically reduces the learning curve for new team members or maintainers.
Meaningful Names: The Fundamental Pillar of Clean Code
One of the most basic—and surprisingly neglected—foundations of clean code is the use of meaningful names for everything: variables, functions, classes, packages, modules, etc.
Every name in your code should clearly communicate its intention, purpose, and use.
If a well-chosen name makes a comment unnecessary, you’re on the right track.
Avoid vague, generic, ambiguous names at all costs. Names like data
, info
, process
, temp
, a
, b
, x
are enemies of clarity.
The Contrast: Messy Code vs. Clean Code (Practical Example)
Here’s a simple but illustrative example (using Go syntax, but the principle is universal):
❌ Messy code:
func doStuff(a int, b int) int {
// Adds two numbers
return a + b
}
Looking at this code, you have to guess (or rely on a comment, which could be outdated):
- What does
doStuff
mean? What “stuff” is it doing? - What do
a
andb
represent?
Now see the same logic with meaningful names:
✅ Clean code:
func calculateTotalOrderPrice(orderPrice int, shippingPrice int) int {
return orderPrice + shippingPrice
}
Just by reading the function signature, the purpose is crystal clear:
- It calculates the total price of an order.
- It adds the order price (
orderPrice
) and shipping (shippingPrice
). - No ambiguity, and the comment is no longer necessary.
💡 Universal Best Practices for Naming
- Favor clarity over brevity. Explicit, descriptive names > short and cryptic ones.
- Reveal intent. Why does this exist? What does it do?
- Avoid misinformation. Don’t use names that can be misleading.
- Make meaningful distinctions. Different names should mean different concepts.
- Use pronounceable names. Helps in discussion and team communication.
- Use searchable names. Avoid
e
,list
, etc., which are hard to find in large codebases. - Avoid unnecessary encodings (like Hungarian or type prefixes, unless enforced by the language/framework).
- Name functions/methods as actions (verbs):
calculateTotal()
,saveUser()
,sendInvoice()
. - Name variables/constants/classes as nouns:
userBirthdate
,productQuantity
,OrderProcessor
.
Always ask yourself when naming something:
“If someone else (or me in six months) sees this name, will they instantly know what it represents without guessing or digging through code?”
Conclusion: The First Step to Readable and Sustainable Code
Writing clean code is a lifelong journey, but it starts with the basics. Choosing meaningful names is undoubtedly one of the most powerful and impactful habits in that journey.
Clear names aren’t just about aesthetics; they reduce cognitive load, simplify debugging, streamline maintenance, and make team collaboration smoother.
Next time you create a function, variable, or class, pause for a moment and think about the name. Remember:
The first and most frequent reader of your code will probably be you. Make your future self’s life easier—and your teammates’, too—by investing time in names that tell the right story.
🚀 Next Article: The Principle of Small Functions
In the next post in this Clean Code in Practice series, we’ll dive into another core principle: small functions that do one thing only. We’ll explore why this is critical to building robust, testable, and maintainable systems.
📣 Let’s Keep the Conversation Going
Have you ever had to clean up a codebase that looked like an unsolvable puzzle?
Drop your experience in the comments or share this article with your team!
👉 Follow me here on Medium and let’s connect on LinkedIn
🔖 Don’t forget to tag your team or share this with other developers who value clean code!
Subscribe to my newsletter
Read articles from Phelipe Rodovalho directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
