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?

  • MyNameIsRichard@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    2 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.

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

  • zod000@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    2 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.

  • /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’

    • tetris11@lemmy.ml
      link
      fedilink
      arrow-up
      8
      ·
      edit-2
      2 months 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

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