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?
Kebab for most things, camel for source code
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.
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.
deleted by creator
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 heavily depends on the context: Filenames? Variables? Functions? Interfaces/Classes? Java? C? Shell?
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’
Snake Case and Pascal Case is what I tend to default to
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 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!
I do kebab with underscores.
Wouldn’t that be snake?
PascalCaseForTheWin
Pascal for server code running C# and Camel for client running TypeScript.
depends on the color of my mood ring
I try to make everything Pascal case. It’s easy to read in a terminal and pretty easy to type.
My file