Snake case

Piece of code from a module of the Linux kernel, which uses snake case for identifiers

Snake case (sometimes stylized autologically as snake_case) is the naming convention in which each space is replaced with an underscore (_) character, and words are written in lowercase. It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames. One study has found that readers can recognize snake case values more quickly than camel case. However, "subjects were trained mainly in the underscore style", so the possibility of bias cannot be eliminated.[1]

A variation is screaming snake case, where words are written in all caps (stylized as SCREAMING_SNAKE_CASE).[2] This convention is used for constants in programming languages like C/C++, Python, Java, PHP, as well as for environment variables.

  1. ^ Sharif, Bonita; Maletic, Jonathan I. (2010). "An Eye Tracking Study on camelCase and under_score Identifier Styles". 2010 IEEE 18th International Conference on Program Comprehension (PDF). pp. 196–205. CiteSeerX 10.1.1.421.6137. doi:10.1109/ICPC.2010.41. ISBN 978-1-4244-7604-6. S2CID 14170019.
  2. ^ "Snake Case". Mozilla Developer Network. 8 September 2023. Retrieved November 10, 2023.