Whats your go-to naming convention? - eviltoast

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?

  • delirious_owl@discuss.online
    link
    fedilink
    arrow-up
    9
    ·
    2 months 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

  • /usr/local@lemmy.ml
    link
    fedilink
    arrow-up
    6
    ·
    2 months ago

    It heavily depends on the context: Filenames? Variables? Functions? Interfaces/Classes? Java? C? Shell?

    • milicent_bystandr@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      I usually like to call my functions cool-Filename and my variables moronic_typeClass. Shell executable aliases look like ‘if\ then\ else’ and C constants are ‘IFTHANELSE’

  • gigachad@sh.itjust.works
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    2 months 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
      1
      ·
      2 months 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.

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

  • flashgnash@lemm.ee
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    2 months ago

    Have been defaulting to kebab case for variable and function names in all languages recently because of cargo yelling at me

    Pascal case for class names cause c#, snake case for python files because it doesn’t like kebab

    Screaming case for env files because that’s what everybody else does

  • hakunawazo@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    2 months ago

    I use PascalCase for classes, camelCase for functions and variables, SCREAMINGCASE combined with snake_case for constants and for filenames/folders mostly snake_case with kebab-case if date or timestamp is involved.

  • Cas@pawb.social
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 months ago

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

  • Epzillon@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 months ago

    Pascal or camel case for code, snake case for files and screaming snake case for globals

  • Leaflet@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 months 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
      • k4j8@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        2 months ago

        For this reason, I use kebab case for directories. But because I agree underscores show spaces better, I use snake case for files.