Skip to main content

📛 Nomenclature

There are 2 hard problems in computer science:

  • cache invalidation
  • naming things
  • off-by-1 errors

Let's take a look at the second one.

Conventions

NameExamplea.k.a.
Camel CasecamelCaseDromedary Case, Hump Case
Pascal CasePascalCaseUpper Camel Case
Snake Casesnake_casePothole Case
Pascal Snake CasePascal_Snake_Case
Screaming Snake CaseSCREAMING_SNAKE_CASEUpper Case Snake Case, Macro Case, Constant Case
Kebab Casekebab-case
Cobol CaseCOBOL-CASEScreaming Kebab Case
Train CaseTrain-Case
Flat Caseflatcase
Title CaseTitle Case
Sentence CaseSentence case

Python

  • Variable: snake_case
  • Constant: SCREAMING_SNAKE_CASE
  • Function: snake_case
  • Class: PascalCase
  • Method: snake_case
  • Module: snake_case
  • PyPI Project: Train-Case of the module name [^1]

PyPI allows [a-z0-9_.-] in project name, with additional normalization rules.

References

Java

  • Variable: camelCase
  • Constant: SCREAMING_SNAKE_CASE
  • Class: PascalCase
  • Method: camelCase
  • Interface: PascalCase
  • Enum: PascalCase

JavaScript

  • Variable: camelCase
  • Constant: SCREAMING_SNAKE_CASE
  • Function: camelCase
  • Class: PascalCase
  • Method: camelCase
  • npm Package: kebab-case of the package name [^2]

npm allows [a-z0-9-_] in package name.

References

HTTP

  • Headers: Train-Case

HTML + CSS

note

HTML tag and attribute names are case-insensitive. The following conventions are just for readability.

  • HTML Tag: flatcase
  • HTML Attribute: flatcase
  • HTML/CSS ID: kebab-case
  • HTML/CSS Class: kebab-case

SQL

info

In PostgreSQL, all identifiers are case-sensitive, but unless you quote them, they are folded to lower case.

  • Table name: Singular snake_case
  • Column name: Singular snake_case

References

References