CamelCase

From Wikiversity
Jump to navigation Jump to search
Navigation: Engineering and Technology » Computer Science » Computer Programming » CamelCase

CamelCase (or camelCase) is a style of writing in which the writer avoids using spaces between consecutive words. CamelCase is one of two ways that are frequently used in professional programming. CamelCase is used in most modern programming languages, including several popular languages such as C, C++, Visual Basic (VB), and JavaScript to name just a few.

Introduction[edit]

CamelCase is a very easy concept to pick up. It should only take about 20-30 minutes at most. If you have any issues or need any help please contact me on my Wikipedia User Talk Page by Clicking Here. I will be more than happy to help anyone who is willing to put some honest effort into this.

What you should learn out of this Lesson[edit]

This lesson will teach you basic CamelCase the way I learned it from my experience as a student in Information Technology. The lesson covers basically everything that you really need to know about CamelCase.

Introductory Example[edit]

The best way to learn, I always say, is "learning by doing", so below I have listed a sentence in regular plain old English, then that same sentence in CamelCase.

Regular sentence: The quick brown fox jumps over the lazy dog.
Sentence in CamelCase: theQuickBrownFoxJumpsOverTheLazyDog

Now, after reading those two sentences take a look at the sentence in CamelCase bellow:

theQuickBrownFoxJumpsOverTheLazyDog

As you can see, I have marked words in a pattern of alternating red and blue text to show you where each word is located. I have also underlined and bolded the first character of every word after the first word. The first character or letter of each word excluding the first word should be capitalized.

Notice that The first letter of the first word in the CamelCase sentence is not capitalized. This is because the capitalization of the first letter of each word is meant to distinguish the words from one another. The first word in a CamelCase sentence is already clearly marked out as the first word which means that you do not have to capitalize it. If you are looking to go into professional programming or a job in programming, you MUST follow these rules.

Example of CamelCase in programming[edit]

Here are some examples of CamelCase in programming languages with the CamelCase in red text.

  • VisualBasic: labelMain.Caption = "Whats up?"


if this were for the purpose of teaching you programming I would have abbreviated or prefixed label for lbl

Feel free to add example in other languages following my format.

  • C: stringName = "Tom";
  • Java: String userName = this.name;

CamelCase Rules Cheat sheet[edit]

  • The First letter of every new word in a sentence written in CamelCase must be capitalized.
    • This excludes the first letter of the first word in the sentence.
  • Note to People interested as Programing or Web Development as a Profession: If you are working in programing writing code, or working in Web Development writing JavaScript, your employer will often want you to follow these rules.

Dont get it? Need Help?[edit]

If you need help, contact me on my Wikipedia User Talk Page by Clicking Here. I am more than willing to help anyone who is willing to give an honest shot and effort at learning this.

External Links[edit]

Having to Do with Hungarian Notation[edit]

Having to Do with things Mentioned in this Lesson[edit]

Tools for handling CamelCase[edit]