What this blog need is a bi-quarterly-ish language themed blog post series, said none of our (two) readers ever. So without further ado we proudly present our bi-quarterly-ish language themed blog post series!!!1!!1! In this premier installment we will look at one of the most difficult things a developer has to do (this one is just right up there with solving NP-hard problems). The problem of naming things.
venn-diagram--2-
This is quite the formidable topic to cover in just one blog post. Therefore this post will focus on just a small subset that exists in the domain. That small subset is what you should absolutely not do when giving name to new things. A few tips on how to handle if what should not exist, exists will also be given.

If it's of any comfort, after doing extensive research it turns out that not only developers struggle with naming things. People who are paid to name things struggle with this cough Norsk Språkråd cough.

godtnorsk

Parents, specially in the United States of America and of European Royal Families, also struggles with this. Because naming things is hard.

gurley
And giving good names is even harder.

ludvig
But it's not this hard.

The no-go-list
A word of caution, this should be used as a rule of thumb. The list of exceptions is of the same length as one for French grammar rules.

  • Don't postfix with numbers. Believe in source control!
    tt2
  • Don't use too long names (tests are exempted). Long names add memory load on us, humans.
    long-names
  • Don't use too short names. Short names makes code more difficult too understand. For loops are exempted and we do love our x', y's and z's.. If you use abbreviations make sure you make a comment about what the full name is.
  • Don't be unclear. Do what you say you'll do and not a bunch of other things or something completely different.
    getrandomnumber
  • Don't be inconsistent. I.E. stick to the same action name through out your code base. (fetch, get, load). If you mess around with prepare, load and get intertwined your code base will be a mess to interpret
    prepare_load_get-2
  • Don't prefix everything with the feature name or entity name, also known as "Smurf Naming Convention".
  • smurf
  • Don't switch two words around.
  • Don't skip proof reading.

Worst of all is the fact that bad naming practices is highly contagious! ☣️ Because what does a developer do when faced with a problem he is not quite sure how to solve? He will look at what others around him have done, and follow their lead, even if it doesn't make any sense.

89BD4866-CA74-4F4C-AD07-6839749159BC-6296-000001B59169F94B

To quote the character "El Raheem" from the cult-movie “Short Eyes”:

Your presence here effects the mind of my people like a fever.

So this happened at a project I worked on:
sok2

Guess what happened a couple of years after the developer that created this mess had left and a new one had arrived (no overlap!)?
sok3

This begs the question; “What can you do?”
In my experience there is only one thing that works:

57853490-22DA-4355-8B9C-834859CAB7B4-6296-000001B0BD06D402

Wow, thats quite medieval, you might say. OK, fair point. In the modern world we do solve our differences a bit, well, different.

B9F7000B-E18C-4035-AA7C-7A2ADEB58E7A-6296-000001B092EBBDA2

Anything is allowed! Social sanctions, public shaming. Just make sure your team understands that language is important.

If no proper purge is executed you risk that what was just an inter-team quirk will quickly expand and other people will suffer because of your poor choices.

Imagine integrating against a 3. party to get a product, your told to check out the their swagger-documentation and this it what you get: What to choose and why?
swagger

Developers do (not always) work in isolation. They sometimes work with business people. If you don't have a properly constructed nuke and launch option from outer space this can spread into the real business side of things:
mellom2

Until the next time I'll leave you with this quotable quote:

Words are all we have, really. We have thoughts but thoughts are fluid. Then we assign a word to a thought and we're stuck with that word for that thought, so be careful with words. I like to think that the same words that hurt can heal. It’s a matter of how you pick them.

― George Carlin