Random mix and match. I’m all for diversity!
Linux
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
It heavily depends on the context: Filenames? Variables? Functions? Interfaces/Classes? Java? C? Shell?
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
Using Windows is a true flex on Lemmy
touch "\" \""
What does this do?
Make a file named just a bunch of spaces with double quotes around them. It's made confusing because of the 4 double quotes, two are escaped by the backslashes immediately before them.
Mental damage
I put newlines in my filenames to break both CLI tools and Windows filesystems
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
I can tell that this guy fucks
This is exactly what I do. It lends itself to something like 'prefix_specific-info_version' which is both sortable and easy to read.
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):
Camel case for short names snake case if it starts getting hard to read
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
1337 case = k3wlf1l3n4m3
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
Counterpoint: you have to use Shift a lot
He probably uses vi. A few hundred more shift-key presses won't stand out.
For this reason, I use kebab case for directories. But because I agree underscores show spaces better, I use snake case for files.
This question just shows how messed up, and broken much of IT is.
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.
SCREAMING_SNAKE_CASE just has the best name
YES, I USE THIS TOO TO STAY CONSISTENT WITH SQL QUERIES
depends on the color of my mood ring
my go_to NamingCovention: ANYTHING but camel-case 🤮
I’ve never been to a naming convention but I have been to some comic conventions!
You should, that's how you can make a name for yourself!
Pascal or camel case for code, snake case for files and screaming snake case for globals
Whatever case I get when my finger reaches the shift key.
The guy on shift before you got the Case of the Missing Variable. What will you get when your finger reaches that shift? Who knows... It will remain... A_Mystery!
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.
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 generally end up using snake case.
For files, kebab case. For variables, snake case. For servers, megaman villains.
Pascal or Camel are best cases
I like Camel Case for code, but mostly because it's ingrained in my brain, coming from Java as my first language.
For folders and files, I like Kebab Case.
Luckily, I was not ingrained by my first programming language like that, or my coworkers would strangle me.
I started with BASIC, which allowed only two letters for variable names...