Looking at some old code and was initially puzzled by a variable named
feet
I have now worked out that this was at one point called
legend_handles
, which then becameleg_hands
, which then becamefeet
sometimes I truly hate my past self
In your past self defense, thats hilarious.
Im sure debugging through that wasnt.
I have done similar things lol
No, no, I think you were onto something there
git blame:
YOU, MOTHERFUCKER!
You have no one to blame
but yourself
Kinda want to start calling my feet leg hands though
In many languages toes are called "foot fingers"/ "fingers of the feet" or something similar.
Documentation has left the chat
What does caraccy mean
(full name) player 1 object character (or just car if theyre driving a car) acceleration Y-axis is my best guess
Could be p1ObjCarAccY, at least the word can be separated
But why cant it be p1CarAcclY (acceleration became accl to avoid confusion with "accuracy")
Actually, why am I even taking this too seriously lol
No no, it IS accuracy. It’s for implementing how much the camera shakes vertically when attacking
thats the joke
It's in fact "CAR acc y".
It obviously stands for Critical-Arithmetic-Register-Accumulator-Yield.
player1ObjectCarAccuracy or player1ObjectCarAcceleratorY
stopShorteningVariableNamesISTG
Oi. Stop shortening your variable names!
I bet it's part of the joke.
I never understood why devs are so allergic to long variable names? I rather know what your variable is for than it being short
Since Objective-C was one of my first programming languages, I started off being used to ridiculously long variable and function names. For example, from Apple’s official code (before they transitioned to mainly Swift):
``` - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath;
```
People get allergic to it after they see some kind of Java nonsense like:
IReducedWidgetFactoryFactoryHandle<RobotWidget> westCoastRobotWidgetReducerFactoryFactoryHandler = new ReducedWidgetFactoryFactoryHandle<>();
westCoastRobotWidgetReducerFactoryFactoryHandler.generateFactory().generateWidget(COLORS.RED_AND_BLUE, urlForRoboticsData.asSafeUrl());
But like, that’s helpful.
Which resource constricted environments keep variable names during runtime?
Yeah don't a lot of languages optimize things like that away during execution?
Like a 15+ character variable name gets converted to a single letter after the compiler converts the code to machine code no?
Uhm, axchually machine code doesn't have variable names 🤓
Yes, but not every language is compiled into machine code. Scripting languages are usually interpreted at runtime dynamically.
First of all, there are more or less no directly interpreted languages. Show me one.
Not even Python does that.
It's all at least byte-code.
Besides that, I want to see prove that long symbol names could cause a directly interpreted program to run slower than it anyway runs. This claim is imho ridiculous.
That isn't what I claimed. One example is Salesforce Apex, which governs how many characters can be used throughout your entire codebase.
Clearly written out text is difficult to read and understand? Especially in comparison to some asldkfjalsdkjf bullshit?
WHAT?!
Some people simply shouldn't be allowed by law to touch any code…
Just because a name is long doesn't mean it's clearly written out. Long names can also be ambiguous, they aren't a panacea to fix a lack of documentation.
Also, just because you disagree with someone doesn't mean you should be a dick.
Long names are difficult to read, short names are impossible to read.
Balance is the key.
doGet() is too short and meaningless.
getSettings() is succinct.
getMyApplicationSettingsJSONForUserConfigurationSection() is too long and unnecessarily verbose.
I feel like people unwilling to seek balance are the "all my code is self documenting" crowd
Use a minifying tool. Keep the long variable names and let the tool change “myLongAssVariableNameThatDescribesASpecificUse” to “a”
If the variable name gets too long it's harder to read than just short variable. I'd rather use i,j,k for index than indexForTableA, indexForRowB, indexForColumnC.
What about tableIndex, rowIndex, colIndex instead?
I'd rather have long name variables than confusing variables all day.
Who cares if it is named RequestNewUnitMenuButtonPrefab, it least I know exactly what it does
I work as an SAP developer. Variable names are no longer restricted but database tables, class names, structure names, etc. very much still are. They fixed this with s4 hana systems, but a lot of companies still use r3 systems so it will take a while until everybody makes the switch. Database tables are the worst offender. They can be at most 16 characters long. Our company requires us to start with the company shorthand (3 characters) and end with the customer number in case of customer specific objects (5 characters). It can be very hard to find a fitting name on that case. This somehow is reflected in the variables as well, variables who are related to a database table will have the name, etc.
Some languages have more descriptive (and strong) types than others.
Which is irrelevant as you don't write and read type names but symbol names!
Most of the time the types are anyway inferred, so you never see them.
I take it you’re not familiar with the history of Hungarian notation?
Regular PR: - 100 comments about formatting - everyone missed how Im mining bitcoin
People who don't understand that code is read many times more often than written, and that it's therefore most important to optimized for reading, never for writing, shouldn't be allowed by law to touch any code, imho.
This brain dead abbreviation bullshit needs to have an end!
There is absolutely no reason to use abbreviation since autocomplete exists. Especially as autocomplete has has fuzzy matching.
Dawg, context based autocomplete is something even base VIM does! 😭
Please rename to stopShorteningVariableNamesISwearToGod
Lazy fucks using "i" instead of its full name "eye"
Because scrolling horizontally to see the entire line is annoying.
Skill.. i mean Screen Issue
Also use word-wrap
use a smaller font size
edit: and break bracketed code into multiple lines for clairty anyway
Yeah sure, that's a great excuse to write cryptic shit!
(Besides it isn't, as other pointed already out…)
If I need more than like… two words in a variable name, something’s wrong. Usually about when I decide I need to break out into another function, honestly.
If I need less than three words in a variable name, that's when I go looking for other important clarifications I can add to the name.
I feel like ScopeName.VariableName should usually be enough.
GetReplies(RootComment) for example feels… sufficient. To each their own though.
"A good variable name is its own documentation."
Which is why all my variable names are thousands of characters long and each one fully documents itself.
Except for x, if something is self-evident I just name it x.
the thing is the autofill is dumb and i need to type out the first word and then part of the second word to get it to get the right one, and typing out a single word is hard :<
There are however IDEs (anything from Jetbrains) which support camel case autocompletion.
As a Java developer, this IntelliJ feature is extremely useful.
Do you code in notepad?
All text editors worth their salt have fuzzy matching. Since decades…
I have a senior who likes to call the struct pointer passed to the function
struct * obj
Just . . . dude. No.
... sure... p1obj == player one object but wtf is a caraccy
car account??? Y-axis ig
Car accuracy
*junior developers. In high school my variables had one letter names - now my vars have a short story in them.
I learned to program on ZX Spectrum. All variables were one character long.
My condolences.
Thanks God we're over this since decades, and now there exists no reason to write cryptic code. Besides being a stupid dick, of course.
OP must be an Objective-C fan.
Famously long variable names.
As for me? Nah. I like short but obvious.
A single letter for loop variables if it's solely for the loop, otherwise naming what it is.
If I have to move my eyes or my head to see the whole name, it's way too long.
My goal isn't description, it's efficiency. As readable as possible, while being as short as possible. Functions should be a few lines at most. Single-line functions should be in-lined, instead, unless it's to create a single place to change something. Reuse of code to do a lot of similar tasks is the goal.
Then, any time it's too complex to understand but space-savings are significant means it's a place for a comment.
OMG!
I hope I never have to see that garbage.
Using comments instead of properly naming things is the most ridiculous shit I've heard in some while. BRR!
Nono, you misunderstand.
I always try to properly name things. Comments are for when the logic doesn't make sense at first glance.
I'm an avid supporter of "code should be self-documenting"
But no, comments bad!!!!! In my todo app all variable names are descriptive and 2 words most!
I can't tell if that is sarcasm or not.
In case you are serious...
That's not descriptive to me, and comments are great. More people should use them.
Code that you write that is just for you? Doesn't matter if it's readable for anyone but you. Future-you may have a bone to pick with you, though.
Code that you write that others have to be able to read? The goal is make it readable at a glance. If it's not obvious what a piece of code does without having to think about it, it needs a comment. If you can't tell what a variable is used for at a glance within 2 seconds, it needs a more descriptive and/or shorter name.
I don't need a sentence to describe a variable.
Bro are you five ofc its sarcasm I cant believe one can't pick up on "!!!!!!!"
Anyone with a drop of thought in their mind knows that you can't express everything in "self documenting code" like brother in christ that is what documentation is for lol.
The people I have to work with on a day to day basis would use "!!!!!!" genuinely.
There are two bothersome problems in software development:
The off-by-one errors increase significantly when you program in Lua
Do you have scientific prove of this claim?
I bet the issues only move elsewhere, as the problem is always the same.
The correct solution would be to have two functions:
offsetBy
(currently wrongly called "index" by most people) andindexOf
(which is missing in more or less all programming languages).I've never had issue with point 1. I can still deal with off by one errors. Race conditions makes me want to kms.
Wait, point 2 as they're labeled, or 2 as they're ordered?Why do want make they you to kys?
I like to say "four" and then: * 1 - naming things * 3 - race conditions * 2 - off by one errors * 4 - cache invalidation * 2 - off by one errors