DEV Community

Riccardo Odone
Riccardo Odone

Posted on • Originally published at

Naming Things Made Easy

You can keep reading here or jump to my blog to get the full experience, including the wonderful pink, blue and white palette.

We were in the office doing meaningful work. Still people couldn't help but move closer to check what the heck was going on. Some were attracted by what we had drawn on the whiteboard. Others approached us because our discussion had gotten too strange to be ignored:

Let's say the the order is pink but yellow happened, would it become brown or green?

It took Mateusz and me hours to collect all those colors, connect them with arrows and draw everything on the board. We were facing a complex problem. Thus, we reached for unconventional tools to make sense out of it.

Naming Things is Hard

No doubt about it. The problem is, in some situations, it is also unproductive and dangerous.

Giving anything a title is best done at last. It's only when the exploration is done, dust settled down and the result is stable that things can be summarized to a sentence. In other words, naming belongs to the editing phase not the writing one.

Never intermix writing and editing. Writing is a diverging activity. It needs space to expand. Editing is a converging activity. It requires compression. They are opposites, therefore, unless the goal is to achieve a mediocre result, be wise and keep them apart.

Write drunk, edit sober

–Peter De Vries

Code is the result of an exploration: the most promising solution of the ones considered. Breaking the flow to think about a name while generating options is not productive. It doesn't matter if a variable is named isFulfilled or yellow in this phase. Really. It doesn't. So let's just throw a color in there. Or the name of your favourite character in Star Trek. Or anything that does not require a disruptive mental effort.

Naming early is dangerous too. Words carry a mental baggage with them. For example, the word "classroom" seems harmless at first. But wait, in my head I see a physical space, several people sitting in front of small desks, a teacher standing on the opposite side and a ton of other details. I can also smell the chalk. Now I feel it on my fingers. Wow. And I thought I was just naming a variable for an online course platform.

It is incredibly powerful to use the proper word in the right spot. It can be catastrophic otherwise. Choosing the wrong name contaminates our thinking. That is a good way to impair our problem solving skills as highlighted in Starting from the Problem not the Solution and Why Good Solutions Block Better Ones.

I have a secret. The code I write sucks until I edit it. I name things with colors. Sometimes it's even a single character. When I feel lazy I call a class Klass and I likely have twenty-three commits named "wip". I would get lost myself if I had to go back to the code a few days later. But I won't need to because I trust my editing self will do the right thing down the line.

Back to the Office

I wish I had a picture of me, Mateusz and the whiteboard to share here. But it's more than enough to have such a great story in my heart. I like to think that, given our shared passion for whisky, we kinda sticked to the "write drunk, edit sober" plan. And it worked wonders. Thanks Mat!

Get the latest content via email from me personally. Reply with your thoughts. Let's learn from each other. Subscribe to my PinkLetter!

Top comments (0)