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?

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

  • GissaMittJobb@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    4 months ago

    General purpose: Kebab case

    But really, follow the conventions of what you’re working on. For example, I’d use pascal case when working on a Java/Kotlin project, and snake case when working on a Python project.

  • orangeboats@lemmy.world
    link
    fedilink
    arrow-up
    8
    ·
    4 months 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”

  • thevoidzero@lemmy.world
    link
    fedilink
    arrow-up
    28
    ·
    4 months 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

  • MyNameIsRichard@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    4 months ago

    Kebab case with Pascal case in the usual places. I’d change to all kebab case but the muscle memory of typing Documents would nearly kill me.

  • thingsiplay@beehaw.org
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    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).

    • Rhaedas@fedia.io
      link
      fedilink
      arrow-up
      3
      ·
      4 months ago

      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.

  • zod000@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    4 months ago

    If its my own personal code, snake case, if I am sharing with my frontend devs then camel case. If I am writing short scripts, then flat.

  • Professorozone@lemmy.world
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    4 months 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.