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?
- Hupf ( @Hupf@feddit.org ) 29•2 months ago
COOLFI~1.AME
- TimeSquirrel ( @TimeSquirrel@kbin.melroy.org ) 6•2 months ago
10 PRINT “FARTS” 20 GOTO 10
- harsh3466 ( @harsh3466@lemmy.ml ) 4•2 months ago
Man I miss basic.
- TimeSquirrel ( @TimeSquirrel@kbin.melroy.org ) 4•2 months ago
It’s more like QBasic dialect, but it’s still actively maintained. It can generate binaries and everything for modern machines.
- UnbalancedFox ( @UnbalancedFox@lemmy.ca ) 2•2 months ago
Im dead! MS-DOS vibes
- delirious_owl ( @delirious_owl@discuss.online ) 26•2 months ago
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
- Allero ( @Allero@lemmy.today ) 14•2 months ago
Using Windows is a true flex on Lemmy
- Gamma ( @gamma@programming.dev ) English7•2 months ago
I put newlines in my filenames to break both CLI tools and Windows filesystems
- QuazarOmega ( @QuazarOmega@lemy.lol ) English6•2 months ago
touch "\" \""
- delirious_owl ( @delirious_owl@discuss.online ) 5•2 months ago
What does this do?
- noisypine ( @noisypine@infosec.pub ) English12•2 months 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.
- QuazarOmega ( @QuazarOmega@lemy.lol ) English5•2 months ago
Mental damage
- unknowing8343 ( @unknowing8343@discuss.tchncs.de ) 15•2 months ago
I am a fan of Python’s or Rust’s official conventions.
For package names, tho, I don’t get why this-is-used over this_clearly_better_system, as I would expect a double click to select_the_whole_thing, whereas it does-not-happen-here.
While i do agree, snake looks a lot better too. I just wish it was possible to navigate through each parts of the word more easily with ctrl+arrow. That would make it the superiour choice imo.
- Telorand ( @Telorand@reddthat.com ) 14•2 months ago
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.
- zitrone 🍋 ( @quantenzitrone@lemmings.world ) 10•2 months ago
How about “cool file name”?
All my systems use modern file systems that are case sensitive and can contain any character except
/
and\0
.- Monstera ( @Monstera@lemmy.ml ) 9•2 months ago
Using commands on that is still more annoying, so no way
- zitrone 🍋 ( @quantenzitrone@lemmings.world ) 3•2 months ago
not really
You can easily escape spaces with
\
and my modern shell (fish) suggests and completes filenames for me anyway, so i don’t have to type more than the first word in more than 90% of cases.- delirious_owl ( @delirious_owl@discuss.online ) 1•2 months ago
Now do it with a for loop on every file in a dir with thousands of files
- zitrone 🍋 ( @quantenzitrone@lemmings.world ) 1•2 months ago
for i in path/to/dir/* dosomething_with_my_file $i end
where is the problem? fish shell doesn’t split arguments at spaces
- delirious_owl ( @delirious_owl@discuss.online ) 1•2 months ago
$IFS splits files at spaces
- zitrone 🍋 ( @quantenzitrone@lemmings.world ) 1•2 months ago
IFS is a special shell variable in bash, ksh and POSIX shells that lets you configure how the shell splits words
by default it splits at spaces tabs and newlines
I use
fish
a shell that is intentionally not POSIX compatible. While it borrows some principles from Bash and POSIX, it simplifies a lot of things and removes most footguns. Words are split at new lines in fish, which admittedly can also cause troubles, but not nearly as often as in bash and other POSIXy shells.- delirious_owl ( @delirious_owl@discuss.online ) 1•2 months ago
Wtf why would you intentionally not be POSIX compatible?
- boredsquirrel ( @boredsquirrel@slrpnk.net ) 5•2 months ago
True. Linux, Android, Windows all have no problems
Using dots in a file though…
- No1 ( @No1@aussie.zone ) 9•2 months ago
IT’S
COOLFILE.NAM
THERE IS ONLY 8.3 AND THERE IS ONLY UPPERCASE
- erwan ( @erwan@lemmy.ml ) 3•2 months ago
FILEID.DIZ
- don ( @don@lemm.ee ) 8•2 months ago
WIAT, Y R U CALLIN IT SCREAMING CASE THAT SOUNDS FKN DUM TBH
L8R DOODZ
-SP4SEM4N B1FF
ive seen it be called both screaming and train case, not sure what the most used term is though.
- don ( @don@lemm.ee ) 4•2 months ago
It’s a reference to Tha Grate Biffinski:
- tatterdemalion ( @tatterdemalion@programming.dev ) 8•2 months ago
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.
- MyNameIsRichard ( @MyNameIsRichard@lemmy.ml ) 4•2 months ago
Given OP mentions kebab-case, this is probably about file-systems. But you are absolutely correct about code.
- communism ( @communism@lemmy.ml ) 8•2 months ago
Snake case. I find it the easiest to read.
- tetris11 ( @tetris11@lemmy.ml ) 5•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 ( @gerdesj@lemmy.ml ) English8•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!
- Cas ( @Casuallynoted@pawb.social ) English7•2 months ago
I’ve never been to a naming convention but I have been to some comic conventions!
- MonkderVierte ( @MonkderVierte@lemmy.ml ) 6•2 months ago
Depending on environment/language and policies. As long as its consistent throughout the project.
- flashgnash ( @flashgnash@lemm.ee ) 1•2 months ago
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
Kebab or snake for ease of parsing through them.
- BaumGeist ( @BaumGeist@lemmy.ml ) 5•2 months ago
1337 case = k3wlf1l3n4m3
- lnxtx ( @lnxtx@feddit.nl ) English5•2 months ago
Depends. Java-like languages ofc camel/pascal case.
Bash, Python, etc., snake case, with constants as uppercase.
Filenames: I prefer snake case.