Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 History  





2 Examples  





3 See also  





4 References  





5 External links  














Snake case






Català
Español
فارسی
Français

Italiano
Magyar

Oʻzbekcha / ўзбекча
Русский
Simple English
Svenska
Українська
Tiếng Vit

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


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

Snake case (sometimes stylized autologicallyassnake_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.

History[edit]

The use of underscores as word separators dates back to the late 1960s. It is particularly associated with C, is found in The C Programming Language (1978), and contrasted with pascal case (a type of camel case). However, the convention traditionally had no specific name: the Python programming language style guide refers to it simply as "lower_case_with_underscores".[3]

Within Usenet the term snake_case was first seen in the Ruby community in 2004,[4] used by Gavin Kistner, writing:

BTW...what *do* you call that naming style? snake_case? That's what I'll call it until someone corrects me.

However, former Intel engineer Jack Dahlgren has stated that he was using the term internally at Intel (and perhaps in dialogue with Microsoft engineers) in 2002.[5][failed verification] It is possible that the term developed independently in more than one community.

As of 2015, names for other delimiter-separated naming conventions for multiple-word identifiers have not been standardized, although some terms have increasing levels of usage, such as lisp-case, kebab-case, SCREAMING_SNAKE_CASE, and more.[6][7][8]

Examples[edit]

The following programming languages use snake case by convention:

See also[edit]

References[edit]

  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.
  • ^ "Snake Case". Mozilla Developer Network. 8 September 2023. Retrieved November 10, 2023.
  • ^ a b Guido van Rossum; Barry Warsaw; Nick Coghlan (2001-07-05). "PEP 0008 -- Style Guide for Python Code".
  • ^ Gavin Kistner (2004-02-23). "Appropriate use of camelCase". Newsgroupcomp.lang.ruby. Usenet: HBn_b.379957$xy6.2073499@attbi_s02. Retrieved 2015-08-13.
  • ^ "Quora". 2013-05-10.
  • ^ "StackOverflow – What's the name for snake_case with dashes?".
  • ^ "Programmers – If this is camelCase what-is-this?". Archived from the original on 2016-08-07. Retrieved 2015-08-13.
  • ^ "Camel_SNAKE-kebab". GitHub. 23 April 2020.
  • ^ "Naming Conventions in ABAP Objects". help.sap.com. Retrieved 2020-07-28.
  • ^ "Ada Programming Guidelines".
  • ^ "Boost Library Requirements and Guidelines". Retrieved 2015-08-13.
  • ^ "Eiffel Class and Feature Names". 28 December 2019.
  • ^ "Elixir Style Guide". GitHub. May 2020.
  • ^ "Programming Rules". Archived from the original on 2010-09-04. Retrieved 2017-08-11.
  • ^ "GDScript Style Guide".
  • ^ "Code Conventions for the Java Programming Language – Naming Conventions". Oracle. Retrieved 2021-08-03.
  • ^ "Coding Conventions". Retrieved 2023-02-03.
  • ^ "Xen wiki". Retrieved 2017-03-15.
  • ^ Damian Conway (2005). Perl Best Practices. O'Reilly Media Inc. p. 44. ISBN 978-0-596-00173-5.
  • ^ "Quick Guide to Some Sources for Naming Conventions for Oracle Database Development". stevenfeuersteinonplsql.blogspot.com. Retrieved 2020-12-30.
  • ^ Michael A. Covington; Roberto Bagnara; Richard A. O'Keefe; Jan Wielemaker; Simon Price (2009). "Coding Guidelines for Prolog (v.3)". p. 14. arXiv:0911.2899 [cs.PL].
  • ^ IBM (July 1965). IBM Operating System/360 PL/I: Language Specifications (PDF). p. 16. Retrieved November 12, 2023.
  • ^ Wickham, Hadley. The tidyverse style guide.
  • ^ "Ruby Naming Conventions". GitHub. May 2020.
  • ^ "Naming – Rust API Guidelines". Archived from the original on 2018-09-16. Retrieved 2019-10-27.
  • ^ "Terraform Naming Conventions". Feb 2022.
  • ^ "Documentation - The Zig Programming Language". Retrieved 2024-03-10.
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Snake_case&oldid=1227628918"

    Categories: 
    Capitalization
    Naming conventions
    Typography
    Source code
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
    Articles lacking reliable references from August 2015
    All articles lacking reliable references
    All articles with failed verification
    Articles with failed verification from May 2021
    Articles containing potentially dated statements from 2015
    All articles containing potentially dated statements
     



    This page was last edited on 6 June 2024, at 22:01 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki