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?

  • gigachad@sh.itjust.works
    link
    fedilink
    arrow-up
    75
    arrow-down
    1
    ·
    edit-2
    15 days ago

    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

    • Odin@lemmy.world
      link
      fedilink
      arrow-up
      12
      ·
      15 days ago

      This is exactly what I do. It lends itself to something like ‘prefix_specific-info_version’ which is both sortable and easy to read.

    • N0x0n@lemmy.ml
      link
      fedilink
      arrow-up
      8
      arrow-down
      1
      ·
      edit-2
      15 days 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… :/

  • Leaflet@lemmy.world
    link
    fedilink
    English
    arrow-up
    51
    ·
    15 days ago

    Snake case.

    • Starts with a lowercase, good for shell autocompletion
    • No spaces, so no worrying about spaces in shell commands
    • ‘_’ is better than ‘-’ because it shows the spaces between words more clearly
  • delirious_owl@discuss.online
    link
    fedilink
    arrow-up
    40
    ·
    14 days ago

    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

  • thevoidzero@lemmy.world
    link
    fedilink
    arrow-up
    28
    ·
    14 days ago

    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

  • Telorand@reddthat.com
    link
    fedilink
    arrow-up
    22
    ·
    15 days ago

    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.

    • Treczoks@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      15 days ago

      Luckily, I was not ingrained by my first programming language like that, or my coworkers would strangle me.

      I started with BASIC, which allowed only two letters for variable names…

  • unknowing8343@discuss.tchncs.de
    link
    fedilink
    arrow-up
    19
    arrow-down
    1
    ·
    15 days ago

    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.

  • otp@sh.itjust.works
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    15 days ago

    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

    • Codex@lemmy.world
      link
      fedilink
      arrow-up
      23
      arrow-down
      1
      ·
      15 days ago

      Interesting, I’d tend to demote the initialism, ie topSecretFbiFiles.tar.gz

      • otp@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        ·
        14 days ago

        That’s probably more commonly accepted. I defer to whatever my team is doing, but for my own files, I wouldn’t want things like UsStudentList or USStudentList which both look wrong to me.

        USstudentList looks right to me, and if that’s wrong, I’m okay with being wrong! Haha

  • gerdesj@lemmy.ml
    link
    fedilink
    English
    arrow-up
    12
    ·
    15 days 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!

  • zitrone 🍋@lemmings.world
    link
    fedilink
    arrow-up
    15
    arrow-down
    4
    ·
    15 days ago

    How about “cool file name”?

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

      • zitrone 🍋@lemmings.world
        link
        fedilink
        arrow-up
        4
        arrow-down
        1
        ·
        15 days ago

        not really

        You can easily escape spaces with \ and my modern shell (fish) suggests and completes filenames for me anyway, so i don’t have to type more than the first word in more than 90% of cases.

        • ouch@lemmy.world
          link
          fedilink
          arrow-up
          6
          ·
          edit-2
          15 days ago

          Typing \ in those cases instead of _ is super annoying.

          In my keyboard layout backspace is behind altgr.

          • zitrone 🍋@lemmings.world
            link
            fedilink
            arrow-up
            1
            ·
            14 days ago

            the standard keyboard layouts (qwerty, qwertz, etc.) are mostly trash

            are there any good alternative keyboard layouts for your native language (finnish if im not mistaken)?

            In Germany there is the Neo Family: Neo{,2}, NeoQwert{y,z}, Bone, Mine, … as well as offsprings of that, but I guess you need your diacritics: å ä and ö. While Neo layouts have these diacritics available, they are made for german, so only ä ö and ü are easily accessible.

            • ouch@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              14 days ago

              Finnish indeed. I’m not aware of any alternative layouts. å is completely unnecessary for finnish, so maybe the layouts you mentioned could work.

          • zitrone 🍋@lemmings.world
            link
            fedilink
            arrow-up
            1
            ·
            14 days ago
            for i in path/to/dir/*
              dosomething_with_my_file $i
            end
            

            where is the problem? fish shell doesn’t split arguments at spaces

              • zitrone 🍋@lemmings.world
                link
                fedilink
                arrow-up
                1
                ·
                14 days ago

                IFS is a special shell variable in bash, ksh and POSIX shells that lets you configure how the shell splits words

                by default it splits at spaces tabs and newlines

                I use fish a shell that is intentionally not POSIX compatible. While it borrows some principles from Bash and POSIX, it simplifies a lot of things and removes most footguns. Words are split at new lines in fish, which admittedly can also cause troubles, but not nearly as often as in bash and other POSIXy shells.

  • Cas@pawb.social
    link
    fedilink
    English
    arrow-up
    10
    ·
    14 days ago

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

  • Fizz@lemmy.nz
    link
    fedilink
    arrow-up
    10
    ·
    15 days ago

    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.

    • imecth@fedia.io
      link
      fedilink
      arrow-up
      6
      ·
      15 days 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.

    • Amroth@feddit.it
      link
      fedilink
      arrow-up
      5
      ·
      15 days ago

      I do the flatcase in my machines too, but it stopped being such big a nuisance to me when I moved to ZSH - it can autocomplete case-insensitively.

      • Fizz@lemmy.nz
        link
        fedilink
        arrow-up
        2
        ·
        14 days ago

        Is zsh a terminal or a language like bash? I don’t get what it is from reading descriptions

        • rhys@lemmy.rhys.wtf
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          14 days ago

          Zsh is a shell like bash that supports shell scripting like bash (though with some syntactical differences). It’s a bit more like ksh than bash, but anyone familiar with bash will have no problems with zsh.

          You can check out oh-my-zsh for an accessible preconfigured version of it (though I’d suggest installing via your package manager rather than the script on their website). I like the jreese theme.