+1 tag for Google+

Wednesday, 22 February 2012

I Love Camel Case

Dan (my colleague) was talking to someone sitting beside me today, and he happened to mention "camel case". It actually refers to the "mashing" of two words together taking out the space, and capitalising the first letter of the second word. An example would be "helloThereHowAreYou".

It gets its name from the shape made from the shape from the "ups" of the upper case letters and the "downs" of the lower case letters, making the compound word look like the back of a camel.

In many scripting languages, (in my case just MEL and Python), I see a lot of it. That's when I came to know about this. However, I was doing it for a few years before I first heard the term "camel case" being used to describe arranging words like this.

This is a huge space saver when it comes to naming variables, functions and objects in my code. Instead of having to name a variable $name_of_my_variable, I can just name it $nameOfMyVariable. It saves me many keystrokes in the long run, and it's quite easy to read (this is arguable when you first start to work with it, but it gets easier as time goes by) ;)

Here are 2 links that explain the practice and the history of how it came about:

CamelCase is also known as CamelBack, CamelCaps or HumpBack notation, and many more.

No comments:

Post a Comment