A Tester's Guide to Letter Cases

A Tester's Guide to Letter Cases

Introduction

The following quote is quite popular in programming:

There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.

If you are reading this article, most probably you are already familiar with the concept of naming conventions in programming. If not, there are a lot of helpful articles and YouTube videos on the topic. I recommend this freecodecamp article.

The purpose of this article is not to re-introduce the topic of naming conventions, but rather to help you memorize what the most common ones are with examples and fancy names.

Let’s see the most common letter cases used in programming with examples:

camelCase (aka Lower Camel Case)

In this format, the first word is lowercase, and each subsequent word starts with a capital letter.

These are mostly used in JavaScript, Java, and TypeScript for variable and function names.

Example:

isUserLoggedIn

Example Code For Camel Case.

Example Code For Camel Case.

PascalCase (aka Upper Camel Case)

Every word, including the first one, starts with a capital letter.

Class names in almost all languages (Java, Python, C#) and React components use this naming convention.

Example:

UserProfileComponent

Example Code For Pascal Case.

Example Code For Pascal Case.

snake_case

Words are written in lowercase and separated by an underscore ( _ ).

Used in Python (variables and functions), Ruby, and Database column names (SQL).

Example:

created_at

Example Code For Snake Case.

Example Code For Snake Case.

SCREAMING_SNAKE_CASE

Like snake case, but all letters are uppercase.

These are used in Constants that are not meant to be changed throughout the program.

Example:

MAX_RETRY_ATTEMPTS

Example Code For Screaming Snake Case.

Example Code For Screaming Snake Case.

kebab-case (aka Train Case / Spinal Case)

Words are written in lowercase and separated by a hyphen ( - ).

You may find these in URL slugs, CSS class names, and HTML attributes.

Example:

main-header-style

Example Code For Kebab Case.

Example Code For Kebab Case.

flatcase

All words are lowercase and joined without any spaces or separators.

Package names in Java or some low-level system configurations might have these.

Example:

userauthentication

Example Code For Flat Case.

Example Code For Flat Case.

Conclusion

Don’t let the jargon intimidate you. These naming conventions are just tools to keep things organized. Once you recognize the patterns—the camel humps, the snakes, and the kebabs— navigating codebases, databases, and API specs becomes second nature.

If you found this post helpful, consider buying me a coffee. It keeps me writing!

Buy Me A Coffee