One of the most important things in a good project is naming. You can’t deny it – Good names of Modules, Classes, Methods and Variables can make the difference between a code that’s a joy to read and obscure text.

Some names are so bad that every time I see them I get a little jolt of annoyance bordering pain. I mean, I worked so hard to build this beautiful piece of code, this piece of art really and it’s now completely ruined by this… Name.

You can’t simply change names either. Changing a name can cause all kind of merge conflicts in all the various branches. More importantly, it will bring overall confusion to the team. For example, once you are used that MainManager is responsible to turn the power On and Off, you can’t simply change it to PowerManager. This will cause mayhem amongst the developers, whose brains already hard-wired that MainManager is the one controlling the power.

There’s also some politics involved. Developers are attached to their work and changing their naming can hurt their ego and programmer’s pride. This is very true for me. Woe to the one who tries to change my function’s name without consent…

Here are some real-life examples of bad naming I encountered:

public bool IsPasswordCorrect()
{
    // Opens a username/password dialog and verifies the password is correct 
}
SomeFunction()
{
    ...
    tmp = ...
    tmp2 = ...
    ...
    tmp7 = ...
    ...
    tmp22 = ...
public void InvalidateUser(User user1, User user2)
{
    // Sends an email to 'user1' that asking if 'user2' is allowed to...
}

What is it about naming that’s so damn for hard for programmers? I mean, we can handle incredible complexity in our head, solve hard problems all day long, but simple naming we can’t handle? Is it one of those left-brain/right-brain sort of things?

I find myself breaking my work for long minutes just to think of a good name. This can go too far though. My friend was once in a Naming Meeting that included 5 people, lasted for an hour, and a good name still wasn’t found.

I guess my overall point is this:

  • Naming is important.
  • Naming is hard.
  • Too many developers slack off in their naming, which results in overall frustration and they should be severely punished. Wait, no, I didn’t mean that. Just… write better names.