Day 15 - Improve a name

First, an administrative note: I’ve changed how I’m numbering the days for our challenge. I’m going to start including weekends as days for counting purposes. I actually meant to do this from the start, so nothing is actually changing, just the number you see. We’ll still stop on 2/7 as planned.

Okay, onward…

Improve one name today. Any name.

It can be a class name, a method name, a variable name, a constant name, a file name, anything.

If you just thought of a name you know needs improving, do that one.

If you can’t find a name that could be improved, consider these questions:

  • Do you ever refer to the same concept slightly differently in different spots?
  • Have you noticed anywhere where a previous rename missed a few references?
  • Pop open your schema. Are your database columns named consistently? (This is just a special case of the first one.)
  • Is the name you’d use to describe a concept to a coworker the same as what’s in the code?
  • Is the name your customers would use the same as what’s in the code?
1 Like

I always struggle with semantical naming. Often I’m unsatisfied with my chosen names especially when I try to read and identify old code and I can’t differentiate between the functionality of functions just by name. One mistake is that when I refactor code I often use a too similiar wording for subfunctions. No more!

Better long and concise, than short and ambiguous.


I’ve improved the names of some constants used in my project and this led to some improvements in the code, so it was a good refactor.
I hope that I didnt broke anything :sweat_smile:

Had some trouble finding spots to improve for this one. Ended up killing a no-longer-used method that had a very generic name (“get_environment”). The best name is no name. :wink:


I’m in process of changing a slightly controversial named for the bad actors in our app to a more neutral one. Lots of code to change so I’m being ultra careful on this one. :no_mouth:

This sprint I’m in charge of renaming a major concept from our domain, so I’ve been working on it today. Also, during this work I had to rename another concept which would be confusing given the major renaming, so a lot of renaming today :sweat_smile:

When trying to find something to rename I stumbled on this SO post. From there I found out about git effort which is available from git-extras (brew install git-extras).

With git effort I was able to run git effort --above 100 to find the files we change the most.

Unsurprisingly, I saw the app’s god class in the list. When opening the file, I was lucky(?) to find the first method could use a rename. It was an example of using a specific name for a general case. Rather than saying updates_account? it was needs_SPECIFIC_ACCOUNT_TYPE?.

Fortunately, it was only used in a small number of places and ended up being a pretty easy change.


git-extras is really nice - thanks @tmr08c!

Sorry for the delay.
This is already a day-to-day task for me.
Sometimes I spend a lot of time finding the right name which will drive my design.
It always amazes me how much a name can free/lock you.
Nice git-extras :+1:

1 Like

I’ve been changing names ongoing whenever I work on a piece of code for awhile. But I took this time to have a general view of the naming in the project. I found quite a few names that were misleading. A lot of them are files ported from other projects that were never renamed to match the new one. For example: eeprom library that actually talk to the spi-flash :wink: I fixed as much as I could in the twenty minutes and left more in my growing list of improvements to make :wink:

1 Like

I found the wonderfully ambiguous name qtProcess(), and after some careful thought, renamed it to the much more accurate emit_keystroke().

Identifying words with just the right meaning is easier for me with a thesaurus. Having a thesaurus integrated into my editor is wonderful. I use it multiple times a day when building new features. If you’re using vim, try out this plugin:

Or see if there are integrations for your editor or OS.

This has dramatically improved the names I’ve chosen for concepts.

1 Like

Lot of changes in this section. I have almost all iterator variables (like the one’s in forEach, filters, maps and so one) with one letter (like k for key or v for value). I’ve change all the names and looks better.