Have you ever seen code that looks like this?
What is “P”? What is the entity we are setting a zip code and a name for? If you scroll up further in the file that this code was taken from you would find that “P” stands for “Prison”.
As a user this would be obvious due to the header (not shown in the screenshot) above the form that displays “Update Prison”. As a developer, you could find out by scrolling up a little ways and ingesting the context that this form lives in.
But the question must be asked. Why did we condense the word prison?
The problem with the above example is that we can’t tell right away what it is that P refers to. This is a relatively common occurrence among the “uninitiated” who believe saving some line space is worth the ambiguity.
It’s not.
When you use condensed variable, function, or class names you run the risk of erasing any discernible meaning from them. Remember, programming languages use English for a reason! Take advantage of this wonderful abstracted interface we are given to write instructions to our machines.
The more your code reads like proper English, the easier and faster it is to understand and work with.
Ahh, that’s better. And look- we used proper JS camelCase too!