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?
my go_to NamingCovention: ANYTHING but camel-case 🤮
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.
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
Is something like this defined in a standard somewhere?
I can tell that this guy fucks
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… :/
This is exactly what I do. It lends itself to something like ‘prefix_specific-info_version’ which is both sortable and easy to read.
For files? I like title case (like in article headlines). For example, I have a “Shell Tricks.txt”. I’m not really consistent though, sometimes it’s all lowercase or whatever really.
spaces in filenames?
oh, my sweet summer child.I don’t use a computer from the 90s. It can handle it.
Both snake and camel case. Sometimes I mix it in the same project and I hate myself for it
I try to make everything Pascal case. It’s easy to read in a terminal and pretty easy to type.
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.
Snake Case and Pascal Case is what I tend to default to
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.
Given OP mentions kebab-case, this is probably about file-systems. But you are absolutely correct about code.
Snake case. I find it the easiest to read.
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
I use flat case most of the time, but I also try to stick to single word files so there is no case to get in the way.
I think for documents I might share like a PDF I’d use Pascal case.
In a classroom or teaching setting I will sometimes use Kebab case as I find it is the least confusing and makes it extra clear where the word division is. Similarly I avoid Dot notation since it’s confusing for folks coming from a Windows world.
And I would avoid Screaming because that’s just too loud anywhere.
Isnt CAPSLOCK case for screaming? 😁
YEAH CRUISE CONTROL BABY
Depending on environment/language and policies. As long as its consistent through the project.
My old projects still have camelCase sprinkled around, you can tell which bits are new and old depending on whether it’s camel or kebab
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”
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):
You can go-to_hell.
Thats what I do as well. It makes it easy to seperate between logical units.
Snake case or kebab case I guess. But why is it called kebab case?
Because it looks like the words are on a rod, like kebab meat
Huh thanks, I guess it’s based on a misunderstanding of the word kebab then. Correctly it would have to be called şiş/shish case then, but that certainly has less of a ring to it.
Skewer case, perhaps?