Curious case of lowerCamelCase


#1

Hi guys, I encountered this in

https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/3

One of the instruction says

First we declare a function using var, and then give it a name sayHello. The name should begin with a lowercase letter and the convention is to use lowerCamelCase where each word (except the first) begins with a capital letter.

I am trying to complete this old track of javascript before it's taken down for good. (still unsure when)

So, about lowerCamelCase, this thing has been something lingered in my mind for a while. I just didn't know what the right term to ask until I saw that instruction.

Upon googling few sites and reading upon Camel Case wiki, I can slightly comprehend how it arrive to current usage of Camel Case in programming.

But still, I am rather curious.

I know in Javascript, Capitalization is important. MyCountry is not equal to myCountry. However, why the practice in programming prefer this:

where each word (except the first) begins with a capital letter.

Coming from a person who has zero computing knowledge:
Is var myCountry, better than var MyCountry?
(Other than explanation I can think of: Capitalizing Each First Letter requires additional one "Shift" stroke? Thus less productive?)

Is it just a preference or is there any deeper explanation for the practice?

Maybe anyone have better understanding/idea or good links can share on this?

Thanks! :slight_smile:

Upon reading further, I come across this PascalCase.
(Observation: I have noticed CC course is taught using lowerCamelCase over PascalCase, just got me very curious.)


Lesson 25 (everyting is good, seems like bug or smth)
#2

i think this is a good read:

http://javascript.crockford.com/code.html

Currently, all the code you create in the exercises is yours, and yours alone

In a company, you very likely get an existing code base, if people have then use camelCase and PascalCase, inevitable, this will leads to problems, code which is more difficult to maintain.

why JS picked camelCase as convention? No idea


#3

To be perfectly honest with you, the reason programmers use lowerCamelCase is mainly due to the fact that it's easy to read and somewhat decent to look at. If I had a bunch of capital letters in my code, not only would it be harder to read, it wouldn't be very pleasent to look at.


#4

Thanks for the link @stetim94 :relaxed:

agreed and understood, could be very problematic with different formats

am wondering about that too.
.


#5

Maybe I wasn't looking at a huge collection of code yet, thus didn't notice much of the difference.
Appreciate your refreshing perspective @aquaphoenix17 , from aesthetic point of view. :smiley:


#6

good change that who wrote JS decided this will be the naming convention, or at least the people involved early on made this decision (one or multiply people)


#7

Guess it would be like how "QWERTY" keyboards inherited till now eh. If I'm not mistaken, QWERTY serve its purpose for typewriter long ago but that form sticks through electronic invention.