Different Types of Programming Case Styles

1 minute read

One of the first things you learn when you just start taking Intro to Computer Science is probably camelCase. Here, I introduce some more case styles and when they’re used respectively.

1. camelCase

This is probably the most common case style. itsWhenYouWriteSomethingLikeThis. The very first letter is in lowercase, and each word starts with an uppercase letter.

2. snake_case

If Python is your first programming language, you’ve probably been using it. But if you’re like a Java programmer who just began learning Python, you might not be familiar with this case style. Instead of writingLikeThis, you_write_stuff_like_this_with_underscores. So, all letters are in lowercase. As the name suggests, in Python, it’s recommended to use snake_case according to PEP 8.

3. PascalCase

So this is something I haven’t heard of. I just found it out when I was researching case styles right before writing this article. Basically, I think this case is the same as camelCase, except that TheFirstLetterIsAlsoCapitalized. We use PascalCase when we name a class.

4. kebab-case

This is a fun one. You might have noticed that the name derives from the imagery of the kebab skewer. We can just replace underscores in snake_case with a hyphen. Generally, this-case-is-used when you name a GitHub repository.

Conclusion

It was fun to revisit camelCase, snake_case, kebab-case, and PascalCase as well! I already knew that I need to use PascalCase for classes and stuff, but I just didn’t even know it has a separate name and it’s “PascalCase.” This is a short but interesting post. I’ll come back with another post!

Leave a comment