The most important benefit is consistency - it does not matter much what the conventions are - what matters is they are applied in a consistent and holistic way.
- Variables should always start with a lowercase letter:
- If the variable name is made up of multiple words, use camelCase:
- Do not use reserved words and special characters in variable names.
- Constants should be in all uppercase letters:
- If the constant name is made up of multiple words, use underscores:
- Function names should always start with a lowercase letter:
- If the function name is made up of multiple words, use camelCase:
- Function names should be descriptive and indicate what the function does.
- Class names should always start with an uppercase letter:
- If the class name is made up of multiple words, use PascalCase:
By following these naming conventions, you can ensure that code is easy to read, understand, and maintain, making it easier to debug, update and collaborate with other developers on a project.
Keep in mind that having naming conventions does nothing unless they are followed and enforced.