Programmers come up with a lot of names for things. It's an old trope that the two hardest problems in Computer Science are:
- Naming
- Cache invalidation
- Off by one errors
We do so much naming that we not only fret and argue about meaningful, accurate, but concise names that we also argue about the way in which those names are represented. Typical programming languages allow names following the broad convention exhibited by this regular expression:
"[a-zA-Z_][a-zA-Z0-9_-]*"
That's essentially "starts with an alphabetical character or underscore, and continues with zero or more alphanumeric characters, underscores, or dashes"1. That may seem restrictive at first blush, but it actually leaves a fair amount of room for creativity. From this humble rule programmers have developed preferences for different case styles#Multiple-word_identifiers|)
flatcase
camelCase
, akalowerCamelCase
PascalCase
, akaCapitalCase
,UpperCamelCase
snake_case
, akac_case
SCREAMING_SNAKE_CASE
, akaMACRO_CASE
kebab-case
, akaskewer-case
,lisp-case
COBOL-CASE
Mixed_Case_With_Underscores
- This regular expression is not completely accurate to what many programming languages use, but it's close enough and that's not the point I'm trying to make↩