DEV Community

Cover image for Code Smell 79 - TheResult

Code Smell 79 - TheResult

Maxi Contieri
Learn something new every day. - I am a senior software engineer working in industry, teaching and writing on software design, SOLID principles, DDD and TDD.
Originally published at ・1 min read

If a name is already used, we can always prefix it with 'the'.

TL;DR: don't prefix your variables.


  • Readability

  • Meaningless names


  1. Use intention revealing names.

  2. Avoid Indistinct noise words.

Sample Code


var result;

result = getSomeResult();

var theResult;

theResult = getSomeResult();
Enter fullscreen mode Exit fullscreen mode


var averageSalary;

averageSalary = calculateAverageSalary();


var averageSalaryWithRaises;

averageSalaryWithRaises = calculateAverageSalary();
Enter fullscreen mode Exit fullscreen mode


As with many of our naming conventions, we can instruct our linters to forbid names like theXxx....


  • Readability


Always use intention revealing names.

If your names collide use local names, extract your methods and avoid 'the' prefixes.


More info


Photo by Josue Michel on Unsplash

One difference between a smart programmer and a professional programmer is that the professional understands that clarity is king. Professionals use their powers for good and write code that others can understand.

Robert C. Martin

This article is part of the CodeSmell Series.

Discussion (0)