this post was submitted on 31 Aug 2024
14 points (100.0% liked)

Linux

47237 readers
3343 users here now

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

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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?

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 9 points 2 weeks ago

Random mix and match. I’m all for diversity!

[–] [email protected] 6 points 2 weeks ago (1 children)

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

load more comments (1 replies)
[–] [email protected] 5 points 2 weeks ago (3 children)

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

[–] [email protected] 4 points 2 weeks ago

Using Windows is a true flex on Lemmy

[–] [email protected] 3 points 2 weeks ago (1 children)
[–] [email protected] 2 points 2 weeks ago (2 children)
[–] [email protected] 5 points 2 weeks ago

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.

[–] [email protected] 4 points 2 weeks ago

Mental damage

[–] [email protected] 3 points 2 weeks ago

I put newlines in my filenames to break both CLI tools and Windows filesystems

[–] [email protected] 5 points 2 weeks ago* (last edited 2 weeks ago) (2 children)

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

[–] [email protected] 1 points 2 weeks ago

I can tell that this guy fucks

[–] [email protected] 1 points 2 weeks 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.

[–] [email protected] 4 points 2 weeks ago (2 children)

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

load more comments (2 replies)
[–] [email protected] 4 points 2 weeks ago

Camel case for short names snake case if it starts getting hard to read

[–] [email protected] 3 points 2 weeks ago* (last edited 2 weeks 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

[–] [email protected] 3 points 2 weeks ago

1337 case = k3wlf1l3n4m3

[–] [email protected] 2 points 2 weeks ago (1 children)

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
[–] [email protected] 3 points 2 weeks ago (2 children)

Counterpoint: you have to use Shift a lot

[–] [email protected] 1 points 2 weeks ago

He probably uses vi. A few hundred more shift-key presses won't stand out.

[–] [email protected] 1 points 2 weeks ago

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

[–] [email protected] 2 points 2 weeks ago

This question just shows how messed up, and broken much of IT is.

[–] [email protected] 2 points 2 weeks 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.

[–] [email protected] 2 points 2 weeks ago (1 children)

SCREAMING_SNAKE_CASE just has the best name

[–] [email protected] 2 points 2 weeks ago

YES, I USE THIS TOO TO STAY CONSISTENT WITH SQL QUERIES

[–] [email protected] 2 points 2 weeks ago

depends on the color of my mood ring

[–] [email protected] 2 points 2 weeks ago* (last edited 2 weeks ago)

my go_to NamingCovention: ANYTHING but camel-case 🤮

[–] [email protected] 2 points 2 weeks ago (1 children)

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

[–] [email protected] 1 points 2 weeks ago

You should, that's how you can make a name for yourself!

[–] [email protected] 2 points 2 weeks ago* (last edited 2 weeks ago)

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

[–] [email protected] 1 points 2 weeks ago (3 children)
[–] [email protected] 1 points 2 weeks ago

Im dead! MS-DOS vibes

load more comments (2 replies)
[–] [email protected] 1 points 2 weeks ago (1 children)

Whatever case I get when my finger reaches the shift key.

[–] [email protected] 1 points 2 weeks ago

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!

[–] [email protected] 1 points 2 weeks 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.

[–] [email protected] 1 points 2 weeks 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!

[–] [email protected] 1 points 2 weeks ago

I generally end up using snake case.

[–] [email protected] 1 points 2 weeks ago

For files, kebab case. For variables, snake case. For servers, megaman villains.

[–] [email protected] 1 points 2 weeks ago

Pascal or Camel are best cases

[–] [email protected] 1 points 2 weeks ago (1 children)

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.

[–] [email protected] 1 points 2 weeks ago

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...

load more comments
view more: next ›