I worked on an absolutely massive codebase, with hundreds of versions on a single branch (don't ask why, I was just following orders).
It was pure code, so no textures or sound, just some text based documentation, occasionally a PDF. It was C and the whole thing basically a monolith so the variable name had to contain the sub part or filename to not get conflicts.
The whole thing was 20Gb and many variable names were over 20 characters.
Text is basically free on any decent system. The "executable" (it was for a microcontroller so no real .exe) was 3MB max as that was the limit.
What how did you got there? Wth are you working on? And yeah I can't understand too why the orders containd more then 100 versions on single branch. Working with git (mostly github if someone care) for quite now, do someone have explain for this?
How did it get there? No clue, when they started using git it already was like that, probably a relic from whatever system they used before and never changed (at least 8 years ago).
Versions were build like Legos, for example version AAA used module X/AAA (its own), but might use module Y/GGG (a shared module). Again why this system? No clue.
Also there were 100s of "main branches" and most times I had to do the work at least 2 times, 1 for the main-main and an another time for the version own specific main. Merging main-main and version-main is a really bad idea.
Once someone made a PR between the 2. GitHub just gave up and said infinite files were modified (with the sideways 8 symbol) and the part where it says lines modified was simply missing. Also I know for a fact GitHub is totally fine with 2 million lines and 2000 files modified in a single PR. If you want to check the files in the browser it is a bit laggy, but works.
For compiled languages, it makes no difference to the final compiled product. For interpreted languages (e.g. JavaScript) minimizers exist (and probably recommended for deployed code).
Fun fact. Modern “romhacks” for Broadcom routers like the legacy netgear nighthawk (like FreshTomato) legitimately run most of the dynamic code off the nvram. So.. tbh if you write a boot bash script (it’s a Debian os) you have to consolidate your “firewall” script of iptables commands within 1024 bytes if you want it to be stable without external JFFS partition.
You most certainly can do this with variables 😂 set “iptables -A INPUT” to $ia1 , do the same for FORWARD and OUTPUT firewall rules with $ia2 and $ia3…etc
This "less storage usage" was never a thing, even in the 90s. Older compilers like C and Assembly already strip names of variables and give them id-numbers. So not even micro-controllers or malware see any benefit in short variable names. You are just hurting the code readability because you don't like to press a few more keys.
The variables become either processor registers or memory addresses anyway during the compilation. The variable name has no meaning after it has been compiled.
The real rule I follow is to use type indicator at beginning. Like integer could be iTemp.
Uuu... I still remember the nightmare of teaching kids programming. Imagine asking them to save the code they just made for the class with appropriate file name and even gave some suggestions on what name to use for that said file... Just to be met with, "Teach, I can't find last week code." Lo and behold, it was saved under 'tung tung tung sahur.py' or something...
if this are your compact variables: [r, c, t, b] -> get some help if this are your compact variables: [res, curFile, txtIter, topBttn] -> totally fine, for small projects
I'm with you, I prefer to use full words like isMyCodeReallyThatBad(hope). But I draw the line of what's acceptable at the second example I gave, annoying but readable.
No you dont give variables small compact names. Why would you even? You're in a IDE and you want to search a variable. Whats better, a small name that overlaps with different variables or a slightly longer but descriptive name that just stands out? Don't fight your IDE. Class names on the other hand......
I like to use GUIDs as names for variables, methods, classes, and functions. But when I’m feeling particularly spicy, I’ll pass them through a sha512 and use the binary result.
The reason why old code had compact names for things wasn't a space complexity reason really, it was partially because a lot of early computer scientists came from mathematics, where they use letters like 'n' to represent an element in a series, and partially because thing like the first C compilers only supported names of up to 6 characters.
You start out well intentioned with namesLikeThisSoEverythingIsVeryClearBecauseCodeShouldDocumentItself then over time you get tired of typing shit out and realize whoever said that was some kind of masochist and you end up i, j k, l , x, x1, x2, a, b, ... and start hating programming all together because now you have to write documentation
maybe you'll save several kilobytes over your code base while making it less readable, then as long as it's a compiled code, it won't matter because the compiler will turn variables into registers, pointers and a bunch of other magic stuff
Hey, a good obfuscator is expensive and a hassle to set up. You are just mad, how well I integrate obfuscation into my project, without any third party tooling.
Usually there are design rules coming from somewhere (project lead, professor, customer).
If there aren't, I prefer to use camelCase for variables and methods, PascalCase for classes and snake_case for constants / tuning variables and file names that don't have other restrictions.
Even interpreted bytecode (like Python) does this too. There are at least 10,000 things you can do to optimize space complexity before you start shortening variable names.
128
u/SteveLouise May 29 '26 edited May 29 '26
Who the hell is worried about storage usage of their code files in the year 2004, let alone 2026...
75
u/revdon May 29 '26 edited May 29 '26
"Giving them random names like "ahshjdn" or "yeetus"."
Someone's discovered Amazon's product naming scheme.
17
u/DarthRaab May 29 '26
Serious answer:
This "less storage usage" was never a thing, even in the 90s. Older compilers like C and Assembly already strip names of variables and give them id-numbers. So not even micro-controllers or malware see any benefit in short variable names. You are just hurting the code readability because you don't like to press a few more keys.
14
u/hdkaoskd May 29 '26
There are only four variable names.
7
u/InternetExplorer9999 May 29 '26
r/FirstWeekCoderMemes
6
u/DarthRaab May 29 '26
You forgot: USING MAGIC NUMBERS
1
u/zaqiu2931 Jun 01 '26
Uuu... I still remember the nightmare of teaching kids programming. Imagine asking them to save the code they just made for the class with appropriate file name and even gave some suggestions on what name to use for that said file... Just to be met with, "Teach, I can't find last week code." Lo and behold, it was saved under 'tung tung tung sahur.py' or something...
6
u/thatguy1000000000 May 29 '26
What? My variables like qifb3idbx and aojw1bd9 named are bad? 🥹
3
u/yodacola May 29 '26
you give names according to their scope. constants are almost always spelled out longer than a parameter name, for example.
3
u/thali256 May 29 '26
Gotta save those 5 bytes on my 2TB disk
10
u/Thinshape12 May 29 '26
i give them compact names simply for simplicity so i don’t have to look at multiline if statements or anything like that
2
u/ByteBandit007 May 29 '26
string Iran, USA;
2
u/Level-Pollution4993 May 29 '26 edited May 29 '26
No you dont give variables small compact names. Why would you even? You're in a IDE and you want to search a variable. Whats better, a small name that overlaps with different variables or a slightly longer but descriptive name that just stands out? Don't fight your IDE. Class names on the other hand......
Yes I'm reading Clean Code
2
u/stumpychubbins May 29 '26
I used to work with an older guy who just named everything stuff like "thingamajig"
2
u/Cautious-Bet-9707 May 29 '26
I just do a, b, c, …. a1, b1, and so on 😁
2
u/Single-Virus4935 May 29 '26
My rule of thumb: the greater the scope the longer/descriptive the name. Smaller scope = short
2
u/git_push_origin_prod May 29 '26
I learned from objective C to make my variable names descriptive. I mean, we have auto complete.
It might sound a little silly to say NSSting *str = [“str” :stringByAppendingString] instead of str += “str” but I am a true gentleman
2
u/Ro_Yo_Mi May 29 '26
I like to use GUIDs as names for variables, methods, classes, and functions. But when I’m feeling particularly spicy, I’ll pass them through a sha512 and use the binary result.
2
u/Reno_Greenleaf May 29 '26
MeaningfulVariableNameAccordingToItsUse
2
u/No_Trade_7315 May 29 '26
x, y, z
2
u/nimrag_is_coming May 29 '26
The reason why old code had compact names for things wasn't a space complexity reason really, it was partially because a lot of early computer scientists came from mathematics, where they use letters like 'n' to represent an element in a series, and partially because thing like the first C compilers only supported names of up to 6 characters.
2
u/artm04 May 29 '26
foo bar
2
u/JonathanMovement May 29 '26
firstweekprogrammerhumor type shit
1
u/OrkWithNoTeef May 29 '26
You start out well intentioned with namesLikeThisSoEverythingIsVeryClearBecauseCodeShouldDocumentItself then over time you get tired of typing shit out and realize whoever said that was some kind of masochist and you end up i, j k, l , x, x1, x2, a, b, ... and start hating programming all together because now you have to write documentation
1
u/KasKyo May 29 '26
It's safeguard in case of layoffs.
1
u/Round_Credit_5158 May 29 '26
Had a friend who used to give variables funny names.
After a while he had no idea what the code was doing lol
1
u/lool8421 May 29 '26
not like compact names save much space
maybe you'll save several kilobytes over your code base while making it less readable, then as long as it's a compiled code, it won't matter because the compiler will turn variables into registers, pointers and a bunch of other magic stuff
1
u/RustiCube May 29 '26
I am now renaming my dog Yeetus.
1
u/thiccshortguy May 29 '26
asadsas
1
u/jonfe_darontos May 29 '26
I wish I wasn't making this up. Let's just say my PR to rename this got me PIPd.
1
u/Xontaro May 29 '26
Hey, a good obfuscator is expensive and a hassle to set up. You are just mad, how well I integrate obfuscation into my project, without any third party tooling.
1
u/FAMICOMASTER May 30 '26
What storage does the variable name use once the compiler is done? Like an extra 8 bytes on the source?
1
u/LanceMain_No69 May 30 '26
Swap 1 and 2, remove 3 cuz it shouldnt even be uttered, and then youll be gettung somewhere.
1
u/Zealot_TKO May 30 '26
Fancy bear turns into hobo bear once he sees the assembly produced
1
u/SysGh_st May 30 '26
Always start your variable names with "ThisVariableIsFor"
Examples:
ThisVariableIsForCountingLostMarbles ThisVariableIsForSignallingThatLighOverThere ThisVariableIsForSettingDisplayBackgroundColour ThisVariableIsForStoringLastStatusCode ThisVariableIsForRealisingIHaveNoMarblesLeft
1
u/BenchEmbarrassed7316 May 30 '26
Just use UUID to name variables.
1
u/Kzitold94 May 30 '26
I've recently starting doing all caps for variable names, to make them easy to spot. I also name them something like "FILE" or "SOURCE."
The all caps does make them easier to spot.
1
u/csabinho May 30 '26
For less storage usage? Why not just minify your code?
1
u/UncleThor2112 May 30 '26
Var1, Var2, etc.
1
u/dvorgson May 31 '26
less storage usage? what year is it?
1
u/urbanxx001 May 31 '26
data1, data2, and data_list
1
u/Schwarzpfad May 31 '26
$ sudo apt install pwgen $ pwgen Enjoy randomity or whatever.
1
u/Lucidaeus Jun 01 '26
I refuse to use abbrevations unless it's far more common to use than not. (Like "lol" instead of "laughing out loud")
Never run into a situation where it's been beneficial to shorten things unnecessarily.
1
u/ExtraTNT Jun 01 '26
Everything is a function and you can always use a lambda…
1
u/Ok-Earth-8004 Jun 01 '26
giving names that are references that only you would understand.
1
u/Chidogrin Jun 02 '26
DO NOT TOUCH MY YEETUS APPLICATION!!!! (┛◉Д◉)┛彡┻━┻
1
u/ImpeccablyDangerous Jun 02 '26
No. The top and middle are the wrong way round.
Variable names are compiled away and storage is cheap.
1
u/Tessimal Jun 05 '26
fixed it
1
u/the_sudixp May 29 '26
Sooo truee
1
u/Tal_Maru May 29 '26
The real question is do you use camelCase, snake_case, or PascalCase?
2
u/borin_k May 29 '26
Bottom one is simulink coder style :)
1
u/neo42slab May 30 '26
Dick1 through dick1000
0
u/[deleted] May 29 '26
[deleted] — view deleted comment