What are Naming Rules? PascalCase, camelCase, snake_case, kebab-case, UPPER_CASE
- When using a programming language, refers to the rules used when naming variables, functions, classes, methods, etc.
- There are rules such as pascalCase, camelCase, snake_case, kebab-case, UPPER_CASE.
- Because these are frequently used terms, it is good to know these rules.
- We recommend that you use the rules that match the language you frequently use.
- In Java, CamelCase must be used, but using SnakeCase makes it difficult for other developers to understand.
- ex) Incorrect use of fineById as find_by_id
What are Naming Rules?
PascalCase
- PascalCase starts the first letter of each word with a capital letter.
- The reason it is named Pascal is because it is a convention used in the Pascal programming language.
- ex) PascalCase, NamingRules
- Used when naming classes in programming languages such as Python, Java, and JavaScript.
camelCase
- camelCase is a method where the first letter of each word except the first word is capitalized.
- The reason it is named camelCase is because it resembles the shape of a camel's back.
- ex) camelCase, namingRules
- Used to name functions and variables in programming languages such as JavaScript, C, C++, and C#.
snake_case
- snake_case writes all words in lowercase letters, and separates words with underscores (_).
- The reason it is named snake_case is because the shape of the underbar is similar to the shape of the body of a snake.
- ex) snake_case, naming_rules
- Used to name variables and functions in programming languages such as Python, Ruby, and PHP.
kebab-case
- kebab-case writes all words in lowercase letters and separates words with hyphens (-).
- The reason it is named kebab-case is because it is similar to the shape of a kebab. It resembles meat on a kebab skewer.
- ex) kebab-case, naming-rules
- In programming languages, hyphens (-) are not often used in variable names, but are used in folder names, file names, etc.
UPPER_CASE
- UPPER_CASE is a method where all words are written in capital letters and words are separated by underscores (_).
- ex) UPPER_CASE, NAMING_RULES
- Used to express constant variables, which are values that do not change in most programming languages.