If you've ever written software or enjoy dabbling in the inspect
right-click option, you have seen these.
In most structured computer languages, whitespace is important. Not necessarily important as in your program won't work if you don't use white space (like those foul demon languages), but important as in your parser will fail if you put white space where it is not expected (ignored).
This is the main reason that your variable/tag/identifier/class/whatever names are one run of characters. This is also the spawning point of the use of these identifier case strategies.
Here are some I use occasionally to frequently; there are many, many more:
snake_case: This is the one I hate most. I have never gotten my underscore-as-space typing mode par excellence. I consider the dash an alternation of snake-case
, still used often in file names as alternative separators.
UPPER_SNAKE_CASE: here too, hate. I sometimes use this to remind myself how awful exposing your dirty bits is in an attempt to feel guilty and never do it again (EW_GUTS
).
PascalCase: We'll always have PascalCase. Pascal was one of the first languages I learned beyond BASIC 20 GOTO 10
stuff[1]. This I use most often for class names and static identifiers. Often used for method names in .NET circles.
camelCase: Now this is where the camel meets the road for me. Instances, variables, private members sometimes prepend an underscore, and often member function names in Javascript circles.
How about new identifier case strategy that uses no case?
metacase
I've been seeing a resurgence of simplicity lately, and from what I have seen, a good rule of thumb for this strategy is: Generally anything you can describe in one—or two—words which would find themselves comfortably sequential in a normal sounding sentence.
Our pattern recognition skills are proper scary. Have you seen tsohe scablmerd wrod stcnenees taht you can raed plfterecy fnie?
So too is our mind adept at recognizing the boundaries between two words that we've been conditioned to see next to each other in common written language.
Maybe noun-verb. This here is a knob frobber: var knobfrobber = require('knob-frobber')
.
Or verb-noun. This here will frob knobs: frobknob(myknob)
.
How about noun-adverb? This large irrational number must be stored: var largeirrational = Math.PI
.
Adverb-noun? You bet! Check out this skookum choocher: skookumchoocher
.
What do you think of metacase?
I did not have the discipline required to write decent software in BASIC. ↩︎