Logo

dev-resources.site

for different kinds of informations.

What's in a name?

Published at
8/22/2024
Categories
learning
cheatsheet
webdev
Author
mwlang
Categories
3 categories in total
learning
open
cheatsheet
open
webdev
open
Author
6 person written this
mwlang
open
What's in a name?

Me: Yo, bot. I need a cheatsheet because I'm bouncing between Ruby, Go, and JavaScript a lot in my new role at work. In software development what are all the most common cases and their definitions such as snake case, pascal case, kebab case. List the name for the casing, the definition, an example, the top 5 languages that uses it, whether it applies to the code/source file itself or is use in naming of the source file. where applicable, include Ruby, Go, Node.js

Da Bot: Here’s a list of common naming conventions (casing styles) in software development, along with their definitions, examples, usage in different languages, and their applicability to code and source files.

1. Snake Case

  • Definition: All letters are lowercase with words separated by underscores (_).
  • Example: example_variable_name
  • Top 5 Languages: Python, Ruby, Go, Node.js, C
  • Application: Used in code (variables, functions), sometimes in naming source files.

2. Pascal Case

  • Definition: Each word is capitalized with no spaces or separators; the first letter of the identifier is capitalized.
  • Example: ExampleVariableName
  • Top 5 Languages: C#, Delphi, Swift, Java, Go
  • Application: Primarily used in code (class names, constants), not commonly in naming source files.

3. Camel Case

  • Definition: Similar to Pascal Case, but the first letter is lowercase.
  • Example: exampleVariableName
  • Top 5 Languages: JavaScript (Node.js), Java, C++, Go, Python
  • Application: Used in code (variables, functions), rarely in naming source files.

4. Kebab Case

  • Definition: All letters are lowercase with words separated by hyphens (-).
  • Example: example-variable-name
  • Top 5 Languages: HTML/CSS, JavaScript (Node.js), Ruby (for file names), URL paths
  • Application: Common in file and directory names, URLs, less often in code.

5. Screaming Snake Case (Constant Case)

  • Definition: All letters are uppercase with words separated by underscores (_).
  • Example: EXAMPLE_VARIABLE_NAME
  • Top 5 Languages: C, C++, Python, Ruby, Java
  • Application: Typically used for constants in code.

6. Lowercase

  • Definition: All letters are lowercase with no separators.
  • Example: examplevariablename
  • Top 5 Languages: C, Unix/Linux file systems, Go, Node.js (sometimes for package names)
  • Application: Sometimes used in file names and identifiers, especially in languages with fewer naming constraints.

7. Uppercase

  • Definition: All letters are uppercase with no separators.
  • Example: EXAMPLEVARIABLENAME
  • Top 5 Languages: SQL, C, C++, Assembly, sometimes in Node.js (for global constants)
  • Application: Used in constants, database schema definitions, sometimes in code.

8. Dot Notation

  • Definition: Words are separated by periods (.).
  • Example: example.variable.name
  • Top 5 Languages: JavaScript (Node.js), Python, Java, C#, TypeScript
  • Application: Commonly used in namespacing, object property access, package names.

9. Train Case (Upper Camel Case with Spaces)

  • Definition: Similar to Pascal Case, but with spaces between the words, and the first letter of each word is capitalized.
  • Example: Example Variable Name
  • Top 5 Languages: Markdown, documentation formatting, sometimes in JavaScript for display names
  • Application: Not used in code, but often seen in documentation and UI elements.

10. Hungarian Notation

  • Definition: Prefixes denote the type or scope of the variable, followed by the variable name in Camel Case or Pascal Case.
  • Example: strExampleVariableName (where str indicates a string)
  • Top 5 Languages: C++, C#, old VB.NET, Delphi, occasionally in Python
  • Application: Used in code, especially in older codebases; rarely in modern practice.

11. Macro Case

  • Definition: All letters are uppercase, with words separated by underscores. This is often seen in macros or compile-time constants.
  • Example: EXAMPLE_MACRO
  • Top 5 Languages: C, C++, Assembly, Objective-C, older C-like languages
  • Application: Primarily used in macros and preprocessor directives.

Each of these naming conventions has specific use cases in different programming languages, and they help maintain code readability and consistency. Some of these styles, like Kebab Case and Dot Notation, are more frequently used for file names or paths, while others like Snake Case and Camel Case are typically seen within the source code itself.

cheatsheet Article's
30 articles in total
Favicon
Vim cheat sheet
Favicon
The Ultimate Cheat Sheet: CLI Man Pages, tldr, and cheat.sh
Favicon
From FZF file preview to a browser for cht.sh to discovering the ideal solution
Favicon
Seaborn Cheat Sheet
Favicon
SQL Quick Reference: Simplifying Database Management
Favicon
Terraform Commands Cheat Sheet
Favicon
JavaScript Interview Cheat Sheet - Part 1
Favicon
JavaScript Interview Cheat Sheet - Part 2
Favicon
Arch Linux Pacman: A Detailed Guide with Commands and Examples 🎩🐧
Favicon
The Art of AI Conversation: 6 Essential Tips for Chat LLM Success
Favicon
Master CSS Selectors
Favicon
End-to-End Flexbox vs. Grid vs. Traditional.
Favicon
Linux Commands Cheat Sheet :)
Favicon
sql joins: moving in together
Favicon
A Yocto Cheatsheet
Favicon
Typescript quick concept refresher and reference
Favicon
cheat sheet for go mod package management
Favicon
Git para Iniciantes: Tudo o que vocΓͺ precisa saber para comeΓ§ar a usar
Favicon
Git Commands You Need for Hacktoberfest 2024 - Git cheat sheet
Favicon
Git Cheatsheet that will make you a master in Git
Favicon
How to learn HTML: 46 great sites, courses and books (all free)
Favicon
Top 5 Cheat sheets for Developers
Favicon
CSS: List of Properties for Text
Favicon
What's in a name?
Favicon
The HTML History and Optimization Cheat Sheet
Favicon
Kubernetes Cheat Sheet: Essential Commands for Beginners
Favicon
🦊 GitLab Cheatsheet - 16 - CICD Catalog
Favicon
πŸ“ SQL Cheat Sheet for Developers
Favicon
The Ultimate SQL JOIN Cheat Sheet
Favicon
JavaScript Cheat Sheets

Featured ones: