Skip Navigation

Whats your go-to naming convention?

As far as I know there are these;

  • Camel case = coolFileName
  • Snake case = cool_file_name
  • Kebab case = cool-file-name
  • Pascal case = CoolFileName
  • Dot notation = cool.file.name
  • Flat case = coolfilename
  • Screaming case = COOLFILENAME

Personally I prefer the kebab/dot conventions simply because they allow for easy "navigation" with (ctrl+arrow keys) between each part. What are your preferences when it comes to this? Did I miss any schemes?

156 comments
  • Snake case. I find it the easiest to read.

    • I'm starting to warm up to Pokemon case, which would simplify functions like

      • GottaCatchThemAll() to 🍚()

      or

      • this to ⚡🐹IchooseU

      which I think we can all agree is much easier to read

  • The only correct answer is to be consistent with the code base you're working in or the language's conventions. If neither of these conventions exist, then someone has already failed you.

    • Given OP mentions kebab-case, this is probably about file-systems. But you are absolutely correct about code.

  • Depends. Java-like languages ofc camel/pascal case.
    Bash, Python, etc., snake case, with constants as uppercase.
    Filenames: I prefer snake case.

  • This question just shows how messed up, and broken much of IT is.

  • Snake if writing in python

    Camel if writing in PowerShell

    I tend to stick with what the language wants me to use.

  • I don't like it but I am used to reading old C codebase (windows: https://learn.microsoft.com/en-us/windows/win32/stg/coding-style-conventions) with Hungarian notation.

    pszMyString 😥

    • That's called camelCase, right? starting off small and then use Upper. Hungarian notation is a form of camelCase, just with the type added in front I think. But that's for coding standards, not filenames. One can think of Hungarian notation as to what file extensions is to files, just added in front. Imagine files named as "txt.MyFile", just for illustration.

  • I don't have a consistent style for everything and it depends on the circumstances. snake_case is often used, especially to avoid spaces. Sometimes I just do flatcase instead, and in rare cases also kebab-case or combined_snake-and-kebab-case. The combined_case is often useful to group parts of the name, like a dates and version numbers together and to indicate what part is constant; example-name_2024-08. Sometimes I also do the "Title Case", which is basically PascalCase, but with spaces. Or even even more weird, "Python_Case", which is PascalCase, but with snake_case, when I want to avoid spaces.

    I often avoid dots in regular filenames, unless they indicate a file extension or format, such as ".svg" and ".inkscape.svg" to indicate its a specific version of the SVG format. Or ".xiso.iso", as a specific compressed version of the regular ISO file (for use with Xemu emulator). Basically the same logic and tradition as ".tar.gz" (but in reverse order).

    • I don't like extra dots simply because pattern matching might get weird down the road. Keep dots for extension type and use Pascal to make it easier to read multiple words. Flatcase only if it's short or I'm lazy for a temp file.

156 comments