The Case For Cases

2 minute read

You know, programmers are a fun bunch. You recognize one because they can argue at length about subtleties of the Python language, know nothing about football, and wear thick glasses.

One of their favorite discussion topics is how to name things and how to write them in sacred text files that make the source code of their Next Big Thing.

So, knowing that a constant should be written LIKE_THIS, is all the difference between a pleasant code review session and one in which you really want to slap the reviewer in the face due to his pedantry. Come on! We do real business here!

The Boring Ones

Lower Case

when you write all letters lowercase as if the shift key on your keyboard doesn’t exist. you are way too busy to care about punctuation and the readers. whatever, they’ll understand.

Sentence Case

Only the first letter of the first word in a sentence is capitalized.

Title Case

First character in every word is capitalized. Except when it’s not. Writers all over the world have since lost all faith in humanity to come up with universally accepted rules. They have since since switched to “start case”, in which all words have the first letter unconditionally capitalized.

Upper Case

THERE’S SOMETHING STUCK UNDER THE CAPS LOCK KEY. I’M NOT SHOUTING! HELP ME!!!1!

Who The Heck Came Up With These?

The following rules apply to the practice of writing compound words or phrases whilst avoiding whitespace separators. This is done to please compilers (since they use spaces to separate tokens) while still making stuff readable to humans.

Camel Case

Each word or abbreviations begins with a capital letter, JustLikeThis.

Dromedary Case

Just like a dromedary has one less hump than a camel, this style loses the first capital letter, likeThis.

Snake Case

No wonder that Pythonistas all around the world prefer_this_style. Ancient books say that this term was coined by an envious Ruby programmer1 who suddenly realized he was missing all the fun of coding with snakes crawling around a computer.

There’s even a study showing that snake case is easier to read than camel case. Take that, Java!

Screaming Snake Case

Like snake case, except this time you stomped on it and it’s MAD_AT_YOU!.

Kebab Case

All lower case letters, with-words-separated-by-hyphens. It’s common in Lisp and Lisp-derived languages. Figuring out why it is called this way is left as an exercise for the reader.

Train Case

Just like Kebab case, except this time each word is capitalized. Called this way because, after enough alcohol and sleep deprivation, words start resembling train carts strung together by dashes.

Conclusion

That’s it! Now move along, I’m sure you have better things to do.

Footnotes