camelCase
As Apple released yet another iPhone today, I would like to commemorate with a discussion of camelCase (of which iPhone is an example) and resolve its primary problem as a naming convention–acronyms.
camelCase is a naming convention for programming (although it is used more broadly). The idea is quite simple, you capitalize every first letter of multiple words in a file name (or variable, etc.) except for the first word (just keep it simple and leave it lowercase; if you capitalize it you have CamelCaps).
I am a fan because it takes less space than using underscores (_) between words (snake case) or spaces (which introduce problems in many coding languages). It is easier to type than adding underscores to variable names and syntax as well.
But what about using acronyms together or at the start of a name? For example, my naming a variable based on the terms “SES”, “VICAT”, and “males” would result in the following:
sESVICATMales
This is confusing–first for distinguishing the first acronym as an acronym. Second (and most obviously), it is confusing because one cannot distinguish between SES and VICAT as two separate acronyms.
The solution to both of these problems is to treat acronyms as a word. This yields:
sesVicatMales
The distinction between the two acronyms is now clear.
Enjoy camelCase!
Recent Comments