59

I constantly forget which is Camel case and which is Pascal case. So I thought that maybe a little history will help. Where do the names of these conventions come from? Is there some history behind their names?

5
  • 6
    Just remember the phrase - A sleeping camel will always have his head lower. Hence the first case is lower case in camel case. This is the only difference between the two naming conventions.
    – RBT
    Commented May 20, 2018 at 23:14
  • 9
    Something I heard that I like is: Pascal is a proper noun, so the first letter is a capital. However, camel is not, it's just a noun, so the first letter does not need to be a capital.
    – JamieGL
    Commented Jul 17, 2018 at 21:40
  • 1
    If you're interested in naming conventions and history, check out 'Hungarian Notation' just for fun.
    – RobS
    Commented Feb 19, 2019 at 4:59
  • I always thought Pascal case was named after the programming language Turbo Pascal, my first true love! Nobody mentioned that? Pascal was case-insensitive, but PascalCase was the convention.
    – Aaron
    Commented Jan 23, 2022 at 13:41
  • Remember that CamelCase sucks as a term because it is ambiguous as the first letter can be upper or lower.
    – null
    Commented Dec 18, 2023 at 20:39

6 Answers 6

75

To remember camel case you have to think about the shape of the capital letters. They are like the humps of a camel as you can see in this image.

Pascal Casing - capitalizes each word:

ThisShouldBePascalCase

Camel Casing - is similiar to pascal case but the first word is not capitalized:

thisShouldBeCamelCase

You can read some history here

UPDATE: Change the camel case image after reading the comments.

4
  • 10
    I don't think the "CamelCase" picture is helpful because it uses Pascal Casing—the first letter is capitalized. Commented Jan 11, 2019 at 18:15
  • 1
    This one is better: en.wikipedia.org/wiki/Camel_case#/media/File:CamelCase.png
    – Jon.Mozley
    Commented Apr 23, 2019 at 13:17
  • While I'd known of this method, I could never remember if the camel's head counted as a capital letter. 🤦🏼‍♀️
    – dx_over_dt
    Commented Aug 3, 2021 at 15:36
  • @Ema.jar please note that Camel Case may have first letter lower or upper. Please correct your statement "but the first word is not caplitalized[sic]". Please see en.wikipedia.org/wiki/Camel_case
    – null
    Commented Dec 18, 2023 at 20:42
54

Pascal is a persons name... a persons name always starts capitalized, whereas 'camel' is just a noun and thus, unless the start of a sentence, is always lowercased.

4
  • 9
    @Nick This answer is different from the accepted answer, because it provides a completely different mnemonic device to remember the difference between PascalCase and camelCase. Commented Oct 3, 2019 at 18:37
  • @CameronBieganek, SO is for technical information, not mnemonics.
    – Nick
    Commented Oct 3, 2019 at 19:39
  • 7
    @Nick OP was looking for help remembering which was which, and this answer provides that help in the form of a mnemonic. Judging by the number of upvotes for this answer, I'm guessing other people were also looking for a way to remember which is which. Commented Oct 3, 2019 at 19:48
  • 3
    Also SO is a resource for learning, and it's sometimes helpful to have many point of views and/or additional information. I believe that's one purpose of being able to add many answers to a single question.
    – ljleb
    Commented Feb 16, 2021 at 23:24
11

camel case - first letter of first word lower case, and first letter of every word, after that should be Upper Case.

Examples:

  • camelCase
  • camelCaseLetter

pascal case - first letter of every word should be upper case.

Examples:

  • PascalCase
  • PascalCaseLetter
1

Pascal Case: in Pascal case every word of each letter should be capital like MossawarHussain

Camel case: As the name show it follow the camel structure of word like mossawarHussain

Difference:

Pascal is a subset of Camel case. The first letter of Pascal is capital and first letter of the camel is small that is the major difference between these two cases.

3
  • So if Pascal case is a subset of Camel case, then Pascal case is also Camel case, right? For ex, VariableName is written in Pascal case, but it's also written in Camel case. Am I right? Commented Dec 5, 2019 at 13:09
  • I believe what the author meant was that, with a camelCase symbol, if you remove the initial lower case letters, you end up with a PascalCase word (just like if you take the camel case "someVeryLongSymbol" and remove the "some" in the front, you get the pascal case "VeryLongSymbol"). In reality, camelCase is not PascalCase, and PascalCase is not camelCase.
    – ljleb
    Commented Feb 16, 2021 at 23:28
  • For set PascalCase to be a subset (or proper subset ⊆) of set camelCase, (PascalCase ⊂ camelCase) it means that EVERY member of PascalCase is also a member of camelCase - but that intersection is the empty set (∅). It's also false that camelCase is a subset (⊂) of PascalCase because the intersection of those sets is also the empty set (∅). Commented Jul 28, 2022 at 17:24
0

In camel case first letter of first word lower case, and first letter of every word, after that should be Upper Case.

Ex: userName userFullName

In pascal case first letter of every word should be upper case.

Ex: UserName UserFullName

1
  • just wanted to share this incase anyone finds this comment, but username is username unless it's a user's name which is userName. so point is, username is the exception.
    – Tumi
    Commented Jun 28 at 12:21
0

I could be wrong. PEP 8, for those writing in python, suggests otherwise.
i.e. in python => CamelCase https://www.python.org/dev/peps/pep-0008/

2
  • 1
    That python PEP reference which shows PascalCase and calls it "camelCase", and shows camelCase and calls it "mixedCase" is an example of don't believe everything you read on the internet - not all sources are authoritative, even the ones that purport to be. Commented Jul 28, 2022 at 17:16
  • 1
    @Steven the Easily Amused, "I don't believe it" ;-) Commented Aug 1, 2022 at 16:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.