Different notations used for compound words
Enrique Moreno Tent
Posted on September 10, 2018
Programmers usually have a problem when they have to use more than one word to describe something, but they are not allowed to use spaces or punctuation signs. An example of this would be to name files. If someone wants, for instance, to name a picture where 2 people are talking, he would like to write John and Mike talking.jpg
, but since a filename cannot contain spaces, he may write something like john-and-mike-talking.jpg
To do this, there are many popular conventions, even though they are not standarized. Let’s take a look at some of them.
Camel case
This system consists in writing compound words or phrases such that each word in the middle of the phrase begins with a capital letter.
suchWonderfulBlog.txt
leaveCommentsBelow.pdf
Pascal case
This is a variation from camel case notation. The only difference is that the first letter of the first word is also capitalized. Also called upper camel case
.
SuchWonderfulBlog.txt
LeaveCommentsBelow.pdf
Snake case
In this notation each word will be joined together with a unique underscore.
such_wonderful_blog.txt
leave_comments_below.pdf
Kebab case
This case is similar to snake case, but instead of using an underscore, an hyphen is used to join words together.
such-wonderful-blog.txt
leave-comments-below.pdf
Let me know if I have missed something!
Posted on September 10, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 27, 2024