DEV Community

Cover image for Pictorial mnemonics; to remember naming conventions
Atul Kushwaha
Atul Kushwaha

Posted on

Pictorial mnemonics; to remember naming conventions

Introduction:

When it comes to naming variables, methods, functions, and classes in programming, adhering to naming conventions is crucial for code readability and maintainability. However, for newcomers to programming, these conventions can sometimes be confusing. In this blog, we present a simple and visual mnemonic to help remember three of the most common naming conventions: camelCase, snake_case, and PascalCase.

1. camelCase:

In camelCase, every word starts with a capital letter except for the first word. The name itself is reminiscent of a camel, and if you picture a camel with a hump, you can think of the capital letter as something bigger, symbolizing the words following it. The image below illustrates this concept.

camelcase

2. snake_case:

In snake_case, every word is separated by an underscore. While this convention may not be as intuitive as camelCase, we can use a visual association to remember it better. Think of a toy snake whose body parts are connected by screw joints, just like the words in snake_case are connected by underscores.

snakecase

3. PascalCase:

PascalCase is quite similar to camelCase, where every word starts with a capital letter. To make this convention memorable, consider that "Pascal" could refer to the name of a person or even a unit of pressure (for all the nerds out there 😂). Since names often start with a capital letter, remembering PascalCase is as easy as that!

pascalcaase

Conclusion:

By visualising these pictorial mnemonics, we hope that naming conventions will become more approachable and easy to recall for both beginners and experienced programmers alike. Consistently following these conventions will lead to cleaner and more organised code, making it easier to collaborate with other developers and maintain projects in the long run. Happy coding!

Top comments (2)

Collapse
 
emtiajium profile image
Emtiaj Hasan

There is also kebab-case!

Collapse
 
coderatul profile image
Atul Kushwaha

Yes, it is mostly used in web development. In other programming languages, hyphens are not allowed as valid characters for variable names to avoid confusion, especially for beginners. Therefore, I intentionally excluded them.