Unwritten rules…every organization, every industry has them. Some ‘rebels’ asky why we do them. Sometimes there is a good reason and sometimes there is not. Today I would like to discuss a standard naming convention in programming, particularly when it comes to variables. This convention is entitled, ‘Camel Case’.
Here is an example of a variable utilizing camel case…
[code lang=”js”]
var myVar;
[/code]
Camel case is when you capitalize the first letter of the second word in a compound word. If it were not a compound word, it should be all lowercase. Specifically, this is called lower camel case. Upper camel case is when you capitalize the first letter of every word. Lower camel case is the standard.
Now, do you have to do this to get your programming to work? In most cases, no, but it is a standard. Why? Mostly for human readability. It is a lot easier for our human eyes to read through code and see these and understand them.
So, if you are not using camel case, begin using it in your code today and make your code easier to read.
Happy coding!
Clay