From camelCase To snake_case - Naming Conventions

Published on
316 words
2 mins read
--- views
Authors

Naming Conventions In Programing

In Programming, Naming Conventions refers to set of rules and patterns used to name a variables, functions, classes, methods, interfaces and so on. These conventions ensure consistency and improve code readability, making it easier for developers to understand and maintain the codebase. Based on the programming language and developement community, naming conventions can vary from one to other.

Popular Naming Conventions

Some of the popular naming conventions used by the developers.

Camel Case

In Camel Case, naming should starts with a small letter. If the name has multiple words, then the words will starts with a capital letter.

first letter of the first word is small and remaining words are capital.

Some of the examples:

  • firstName
  • lastName
  • proofOfIdentity

Pascal Case

Pascal Case is similar to Camel Case. But the difference is, it starts with a capital letter.

Some of the examples:

  • FirstName
  • LastName
  • ProofOfIdentity

Snake Case

In Snake Case, naming should starts with a small letter. If the name has multiple words, then the words will starts with a small letter with underscore (_) to seperate the words.

In a nutshell, first letter of the each word is small, seperated with (_).

Some of the examples:

  • first_name
  • last_name
  • proof_of_identity

Kebab Case

Kebab Case is similar to the Snake Case, But hyphen (-) is used instead of (_) to seperate the words.

Some of the examples:

  • first-name
  • last-name
  • proof-of-identity


Conclusion

We've seen the most popular naming conventions that you should know.Naming conventions are not something related to programming language. Instead, they are adopted by developers across the world and considered best practice to produce clean, readable and maintainable code. It's good to familiarize yourself with the naming convention within your developement team or organization.

Bella - Ciao