What is Screaming Snake Case?
Screaming snake case is a naming convention used by software developers that insists compound words used in variable names be separated by an underscore, and written entirely in upper-case letters.
Screaming Snake Case Examples
The following are examples of screaming snake case:
The reference to screaming comes from the fact that when users type in all capital letters in a Tweet, internet forum or a Facebook group, it is interpreted as the person shouting or screaming.
Snake case, also known as train case, can be written in lower-case letters. But when it is, it is just called snake case, not SCREAMING SNAKE CASE.
How to write in Screaming Snake Case
To write a variable in Screaming Snake Case:
- Choose a varaible name that consists of more than one word
- Separate the independent words with an underscore
- Change any lower-case letters to upper-case
Screaming Snake Case vs Kebab Case
Snake case is often compared to kebab case. In kebab case, compound word variable names are separated by a dash, not an underscore.
Kebab case is arguable more readable than snake case, but the dash can be misinterpreted as a subtraction sign in code, which may introduce bugs. As such, kebab case is often avoided as a variable naming convention.
While upper case letters with an underscore is known as SCREAMING_SNAKE_CASE, upper case letters with kebab-case is known as a SCREAM-KEBAB.
Screaming Snake Case UiPath Exam Question
Question: The variable
UIPATH_ASSOCIATE_EXAM is said to follow what naming convention ?
- camel case
- snake case
- screaming snake case
- kebab case
The UiPath varaiable
UIPATH_ASSOCIATE_EXAM is said to be written in screaming snake case. This makes C the most correct answer to this question.
UiPath & Screaming Snake Case
The use of the underscore to separate words in a UiPath variable is called snake case, so option B is somewhat correct. But when all the letters are uppercase, the naming convention is known as
screaming snake case so C is the most correct answer of the bunch.
Screaming snake case violates the UiPath RegEx rule
([A-Z]|[a-z])+([A-Z]|[a-z]|[0-9]) and as such it is not considered a valid variable name and will be flagged by the UiPath Anaylze File process.
Screaming snake case is commonly used for constants. In Java, all static final constants are written in screaming snake case.