Explanations with examples of the most common naming conventions in programming: Camel case, Pascal case, kebab case, snake case and underscore case.
Naming conventions homogenize code, which has the advantage of making it easier for developers to find the names used in a project (both to name them and to call them) and to collaborate more easily when a code is written with several people. In all cases, it is advisable not to use accents or special characters (except in special cases, such as the jQuery framework which uses the dollar symbol "$" to name its main class).
Conventions : The Camel case
Convention: words are linked without spaces. Each word begins with a capital letter with the exception of the first.
Examples: myVariableName, myUrl
Conventions : The Pascal case
Convention: words are linked without spaces. Each word begins with a capital letter.
Examples: MyVariableName, MyUrl
This convention is used in the Pascal programming language or to name classes in PHP.
As with the Camel Case, only the first letter of acronyms are capitalized. This convention is also used by some brands to communicate an innovative aspect such as PlayStation, QuickTime or MasterCard.
Conventions : The Kebab case or Spinal case
Convention: the words are in lower case and are linked by hyphens (-).
Examples: my-variable-name, my-url
The kebab case is recommended for writing URLs as well as naming images, PDFs and other files for the web. In programming, it is used, for example, to name classes and IDs in HTML and CSS code.
The name Kebab case actually refers to the kebabs more than to the kebabs themselves, like a word skewer made of dashes. As for Spinal case, it refers to the spinal column.
Conventions : The Underscore case or Snake case
Convention: words are in lower case and are linked by underscores (lower dash: _).
Examples: my_variable_name, my_url
The underscore case, also called snake case, is used in PHP, Ruby and Phyton. There is a variant of this convention. Named screaming snake case, which consists in putting all words in uppercase, always separated by underscores (Example: MY_CONSTANT_NAME). We find this form in the names of constants in PHP or to name exceptions in ADA.
Programming conventions in WordPress
You can find the conventions and best practices of programming for the themes, the pluginsand the core WordPress documented in the codex.