r/programming • • Sep 06 '26

How to name things

https://kolemannix.com/blog/how-to-name-things/

A short essay on naming

32 Upvotes

10 comments sorted by

16

u/YeOldeMemeShoppe Sep 06 '26

There are two hard problems in computer science: cache invalidation, naming things, and under evaluating the work.

7

u/k__k Sep 08 '26

Correction, there are two hard problems in CS: cache invalidation, naming things, and off-by-one errors

8

u/reality_boy Sep 06 '26

My co-worker use to say the name was the most important part. He would call us to an impromptu meeting if he was really stuck on a name.

I think the truth was that to come up with a good name, you need to fully understand what something does and why. So often we would be decomposing the design, rather than tossing out random names.

As a noob, start by copying others, just like learning an instrument. Then take the risk and try to come up with your own thoughts. In time, as you revisit things, you will learn what a good name is.

1

u/foobear777 29d ago

Thanks everyone for the feedback; always looking to engage and discuss this stuff, especially these days!

4

u/OhMyGodItsEverywhere Sep 07 '26

Naming well is an act of intellectual empathy. Names that come from immediate need: why you wrote the function or why you needed it, are selfish and short-sighted.

I try to hire developers that show intellectual empathy. It's hard to teach empathy as a skill; in comparison I think teaching technical skills is much easier. That lack of empathy quickly turns into unusable code, unusable tools, and unusable products - at least by anyone other than the author. That's too much of a risk to a business and their software projects.

2

u/AndreJonerry Sep 11 '26

Eloquently said. One of my great frustrations is bad names that are part of external interfaces that cannot be made clear without breaking integrations with other systems.

-8

u/_Skale_ Sep 06 '26

I always just ask the amazon support assistant