What is CamelCase? UpperCamelCase vs lowerCamelCase

CamelCase is a name that programmers use to describe code. It’s also called bicapitalization, InterCaps, medial capitals, Bumpy Case, and Pascal Case.

CamelCase is a way of naming and writing code that eliminates confusion. It starts with a lowercase letter for the first word in an identifier or uppercase letter without an identifier, followed by capitalization after each subsequent word. The last word is also capped but has no space between it and the next identifier. For example, “camelcase” would be written as “CamelCase” or “camelCase”.

//UpperCamelCase for class name and lowerCamelCase for variable and function name:
class ProductDelivery extends APIController {
    protected $productName;
    public function getProductBrand(){
        
    }
}

The term comes from the way the lettering looks when it’s written in this style. For example, “TheQuickBrownFoxJumpedOverTheLazyDog.” You can see how each word begins with an uppercase and then has some letters that are lowercase but most of them also have an uppercase letter somewhere in them as well.

As you see in the example, internal capital letters resemble the humps on a camel’s back.

2 types of CamelCase

There are two types of CamelCase: UpperCamelCase and lowerCamelCase.

UpperCamelCase is often used as Class name in most programming languages, while LowerCamelcase is more common when mentioning variable names or anything that’s not a class name.

The style you use usually depends on what the language supports best (some do not support either).

Leave a Comment

Your email address will not be published. Required fields are marked *