Day 15 - Improve one name

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?

Went through a couple areas of my project and re-named some variables. Nothing really unclear, mostly just inconsistent - using “IsXYZ” for bools, stuff like that.

1 Like

I improved one name that was basically a lie, not just a suboptimal name. :muscle:

2 Likes

If you aren’t familiar with it yet, I recommend Arlo’s series on naming: https://www.digdeeproots.com/articles/naming-as-a-process/

The key ideas are:

  • You don’t have to find the perfect name right away (you can’t)
  • An obviously nonsensical name helps you warm up
  • An obviously nonsensical name is better than a misleading one!
  • It’s easy to get to an honest name, even if incomplete
  • It’s fine to stop at any step (see these as ratchets)
1 Like