Skip to content
Home » Naming Conventions For Programming Languages

Naming Conventions For Programming Languages

Naming conventions make programs more understandable by making them easier to read. Following is a list of commonly used case styles.

Cases

Camel Case

Snake Case

Screaming Snake Case

Kebab Case

Conventions for Popular Programming Languages

Java

ItemConventionExample
ClassStart with an uppercase letter.
Use nouns for eg. User, Thread, Controller, Service, etc.
public class User
InterfaceStart with an uppercase letter.
Use adjectives such as Runnable, Handler, Listener.
interface Runnable
MethodStart with a lowercase letter.
Use a verb such as print(), login(), invoke()
If the name contains multiple words, start with a lowercase letter
followed by an uppercase letter such as calculateTax()

void invoke()
void calculateTax()
VariableStart with a lowercase letter such as id, or name.
Do not use special characters.
If the name contains multiple words, start it with the lowercase letter
followed by an uppercase letter.
int id;
String fullName;
PackageLowercase letters such as java, lang.
If the name contains multiple words, separate by dots (.)

package dev.ctrlshift;
package dev.ctlshift.user.interface;
ConstantUppercase letters.
In case of multiple words, separate by an underscore(_) such as LOG_FILE_SIZE

static final int LOG_FILE_SIZE = 18;

Python

Item ConventionExample
ClassStart each word with a capital letter (CamelCase)
Do not separate words with underscores.
ModelMyClass
MethodUse a lowercase word or words.
Separate words with underscores to improve readability.
class_methodmethod
VariableUse a lowercase single letter, word, or words.
Separate words with underscores to improve readability.
xvarmy_variable
PackageUse a short, lowercase word or words.
Do not separate words with underscores.
packagemypackage
ConstantUse an uppercase single letter, word, or words.
Separate words with underscores to improve readability.
 MY_LONG_CONSTANT
ModuleUse a short, lowercase word or words.
Separate words with underscores to improve readability.
my_module.py