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?

top 50 comments

sorted by: hot top controversial new old
[–] 77 points 2 years ago* (4 children)

It depends a bit on the use case. I try to follow naming conventions within specific environments like Python. When just sorting some documents together, I usually do a mix of Kebab and snake case, where I split semantic parts with underscores and connect words with dashes like

2024-08-30_author_document-name_other-important-info.ext

  • source
  • hideshow 6 child comments
  • [–] 7 points 2 years ago* (last edited 2 years ago)

    Yeahh that's the best IMO ! But I get most of the time stuck with some testOFtest001 files/directory... cause I'm lazy...

    But I always ALWAYS regret it afterward... :/

  • source
  • parent
  • load more comments (2 replies)
    [+] 51 points 2 years ago* (last edited 10 months ago) (1 child)
  • [–] 42 points 2 years ago (3 children)

    I put an unnecessary amount of spaces in all my file names to break anyone who wants to use CLI tools on them

    i use windows btw

  • source
  • hideshow 6 child comments
  • [–] 39 points 2 years ago (2 children)
  • load more comments (1 reply)
    [–] 28 points 2 years ago (2 children)

    Underscore to delineate different parts, hypen to delineate words.

    Like: my-resume_draft.pdf

    And to make it consistent and easier to reuse parts for project names and such, I have a command line utility written for it. It caches the parts and uses a template system (support for generating current datetime in parts)

    Available here (is in AUR too):

    https://github.com/Atreyagaurav/nameit

  • source
  • hideshow 4 child comments
  • [–] 23 points 2 years ago (1 child)

    I like Camel Case for code, but mostly because it's ingrained in my brain, coming from Java as my first language.

    For folders and files, I like Kebab Case.

  • source
  • hideshow 2 child comments
  • [–] 22 points 2 years ago (1 child)

    SCREAMING_SNAKE_CASE just has the best name

  • source
  • hideshow 2 child comments
  • [–] 18 points 2 years ago (3 children)

    I am a fan of Python's or Rust's official conventions.

    For package names, tho, I don't get why this-is-used over this_clearly_better_system, as I would expect a double click to select_the_whole_thing, whereas it does-not-happen-here.

  • source
  • hideshow 3 child comments
  • load more comments (3 replies)
    [–] 13 points 2 years ago* (1 child)

    IT'S

    COOLFILE.NAM

    THERE IS ONLY 8.3 AND THERE IS ONLY UPPERCASE

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 13 points 2 years ago

    For files, kebab case. For variables, snake case. For servers, megaman villains.

  • source
  • [–] 13 points 2 years ago (1 child)

    Camel case, but with a twist -- if the next word is about to start after a capital letter, I'll have it lower case.

    topSecretFBIfile.txt for example

  • source
  • hideshow 2 child comments
  • [–] 12 points 2 years ago

    I like to use my enterprise number and a UUID (all in lower case, for legibility). Here's an example:

    .1.3.6.1.4.1.33230.0d456e46-67e6-11ef-9c92-7b175b3ab1f1
    
    

    Now you might say that the UUID is already globally unique or at least pretty unlikely to turn up anywhere else, so why bother prefixing it with more stuff? To that I say: "I need to be absolutely or at least reasonably sure ... OK nearly sure".

    Anyway, you maintain a database of these things and then attach documentation and meaning to them. An editor could abstract and hide that away.

    I started this post as a joke. Not sure anymore. Why get your knickers in a twist with naming conventions for variables and constants. Programming is already a whopping layer of abstraction from what the logic gates are up to, another one wont hurt!

  • source
  • [–] 11 points 2 years ago (2 children)

    How about "cool file name"?

    All my systems use modern file systems that are case sensitive and can contain any character except / and \0.

  • source
  • hideshow 4 child comments
  • [–] 10 points 2 years ago

    For files? An unholy amalgam of snake, kebab and dot, depending on what exactly I'm trying to convey. (I still have much-ported files around with DOS 8.3 filenames, so they're truncated scream case (SCREAMIN.NAM), but I don't actively name files like that anymore.) The important thing is to separate the words/sections while using characters that are valid without escapes in both ext4 and vfat if at all possible.

    For variable names, camel or Pascal case (depending on language convention) if I think anyone else is going to read it. Flat case for code I don't think anyone else is ever going to see (don't do this—it has left teethmarks in my ass from time to time and will do the same to you).

  • source
  • [–] 10 points 2 years ago (1 child)

    Snake case. I find it the easiest to read.

  • source
  • hideshow 2 child comments
  • [–] 8 points 2 years ago*

    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

  • source
  • parent
  • [–] 10 points 2 years ago (1 child)

    I’ve never been to a naming convention but I have been to some comic conventions!

  • source
  • hideshow 2 child comments
  • [–] 10 points 2 years ago (3 children)

    WIAT, Y R U CALLIN IT SCREAMING CASE THAT SOUNDS FKN DUM TBH

    L8R DOODZ

    -SP4SEM4N B1FF

  • source
  • hideshow 3 child comments
  • load more comments (3 replies)
    [–] 10 points 2 years ago (5 children)

    25% Camel case, 25% Pascal and 50% of the time flatcase. It drives me insane when I try and autocomplete a folder only to realise it was Downloads instead of downloads. I keep telling myself i will go through and make it all flatcase but I put it off because i tell myself i will rebuild my computer next week every week.

  • source
  • hideshow 6 child comments
  • [–] 6 points 2 years ago

    Never thought about making the home folders flatcase, thanks, takes all of 2 minutes btw.
    If anybody else wants to do it, remember to edit ~/.config/user-dirs.dirs with your new flatcase folders.

  • source
  • parent
  • load more comments (4 replies)
    [–] 10 points 2 years ago (1 child)

    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.

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 9 points 2 years ago

    Random mix and match. I’m all for diversity!

  • source
  • [–] 8 points 2 years ago

    It really depends.

    If I know I will never open the file in the terminal or batch process it in someways, I will name it using Common Case: "Cool Filename.odt".

    Anything besides that, snake case. Preferably prefixed with current date: "20240901_cool_filename"

  • source
  • Kebab or snake for ease of parsing through them.

  • source
  • [–] 8 points 2 years ago

    Unless I can't, Kebab.

    No need to hold Shift.

  • source
  • [–] 8 points 2 years ago

    Kebab. Not my favorite visually speaking but I had RSI issues for a while and I'm still very focused on limiting keystrokes (no shift key needed with kebab).

  • source
  • [–] 7 points 2 years ago* (last edited 2 years ago) (1 child)

    Depending on environment/language and policies. As long as its consistent throughout the project.

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 7 points 2 years ago

    Snake case, but I'm the World's second worst programmer and just name files like this because I was alive when spaces were not allowed.

  • source
  • [–] 7 points 2 years ago* (last edited 2 years ago) (2 children)

    Rfc3339 plus kebab case for many things

    2024-09-01_lname-fname-resume.pdf

  • source
  • hideshow 2 child comments
  • load more comments (2 replies)

    I've got a personal convention that file names get snake case, directory names get Pascal case.

  • source
  • [–] 6 points 2 years ago

    IWRITELOTSOFBASH

  • source
  • load more comments
    view more: next ›