Programming naming conventions

ยท

2 min read

Whether you are naming functions or variables , you need to be consistent on how you write them and knowing various naming conventions and their usage can be important. There are many naming casing conventions but I will suffice to a few listed below where I believe to be most common / useful to know.

Flat case:

As the name suggest, this naming convention is written all in lower case without any separator. This naming convention is to be used in writing package names . eg: mypackage / fansypackage .

Camel case

Camel case naming are similar to hump of common camels and such only the first word is written in small case and the first letter of following words are capitalize. Such naming convention is quite popular as many companies are products are following the same casing such as eBay and iPhone.

Pascal case :

In this convention , the first letter of every word is upper case and no underscore or dash is used. eg: InvoiceValidator. Class declaration are (strongly) recommended to use this casing by convention.

Kebab case :

This is a less common used format where words are all lowercase and are separated by dash/Hyphen. This naming convention is mostly is used in URLs and is actually not possible to declare a variable in python with such casing .

Snake case :

In snake case convention, words are separated by an underscore and by convention this format is used in naming functions, methods and variables with an expectation of constant variables.

Screaming snake case:

As the name suggest, this convention follows snake case expect every word is capitalize. e.g : MAXIMUM_CAPACITY . This naming convention is used when one is declaring Constant variables.

Did you find this article valuable?

Support Afternoon ๐Ÿช by becoming a sponsor. Any amount is appreciated!

ย