Kalidas
4 min readApr 11, 2023

As programmers, we tend to follow guidelines for each programming language that are accepted by the team and programming community of that particular language referred to as coding conventions, and of them, the most common is the naming conventions So what are naming conventions? These are the set of rules that are accepted by the programming community and are followed by programmers like the naming of variables, classes, functions, etc.

Naming conventions differ for different programming languages. Such conventions are necessary as it:

Helps to improve the readability of code

Make the codebase uniform to give it a consistent look

Help to better maintain the code base for future modifications and references.

There are many styles out there and many of you might have heard of them…

To see the significance of the naming convention look at the below example:

Imagine you are going to create a variable “total word count = 100” but in all programming languages it is not allowed to have spaces in variable names so a programmer has different ways to name the above variable like

Thus you can see that a single variable can be named in different ways and as you may have understood it is necessary to have naming conventions for each language to maintain consistency readability efficiency and productivity.

The popular naming conventions are:

CAMEL CASE

This casing convention capitalizes the first letter of each word except for the first word and each word has no spaces in between

Camel Case

Example: totalWordCount

PASCAL CASE

This casing convention is similar to camel case except that instead of the first letter of the very first word being small here all the first letters of each word are capitalized

Example: TotalWordCount

SNAKE CASE

In this casing convention, all words are in lowercase and are separated by an underscore (‘_’).

Example: total_word_count

UPPER SNAKE CASE

Similar to the snake case as the name suggests all the letters are capitalized and each word is separated by an underscore.

Example: TOTAL_WORD_COUNT

KEBAB CASE

Here each word is separated by a hyphen(‘-’). It is mostly used in web development like css etc. and its applicability for other languages is limited. You will also find kebab case in URLs.

Example: total-word-count

SCREAMING CASE

This notation is similar to the upper snake case the only difference is that here all words have no spaces in between and are not separated using any character.

Example: TOTALWORDCOUNT

Hungarian notation

This is unlike other naming notations we have seen so far, in this the main word is prefixed with another word to create a meaning for the whole word only the prefix is in lowercase and the rest of it is in camel case.

For example to create a variable “ TotalCount“ of type integer we refer to it in Hungarian notation as “intTotalCount”.

However this notation is not used in modern types as it is a pretty old notation that was developed to be used in BCPL which was a low-level language that did not have type checking(which data type the variable uses i.e. if the variable is of type integer or floating point number etc.)and so it was necessary to mention the type, so this notation was used. This notation is currently not preferred and not used in modern programming conventions as it is found unnecessary to mention type in variable naming because all languages come with some sort of type checking.

So I believe my effort here to create an understanding of the naming notation has been successful. if you have enjoyed it please follow to get updated on more content :)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Kalidas
Kalidas

Written by Kalidas

I’m a tech, science and business hobbyist who is currently learning app development,basically I’m a programmer.

No responses yet

Write a response