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
I have done similar things lol
In your past self defense, thats hilarious.
Im sure debugging through that wasnt.
No, no, I think you were onto something there
Kinda want to start calling my feet leg hands though
git blame:
YOU, MOTHERFUCKER!
You have no one to blame
but yourself
What does caraccy mean
thats the joke
(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
player1ObjectCarAccuracy or player1ObjectCarAcceleratorY
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;
```
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.
Use a minifying tool. Keep the long variable names and let the tool change “myLongAssVariableNameThatDescribesASpecificUse” to “a”
Some languages have more descriptive (and strong) types than others.
stopShorteningVariableNamesISTG
Oi. Stop shortening your variable names!
Regular PR: - 100 comments about formatting - everyone missed how Im mining bitcoin
Dawg, context based autocomplete is something even base VIM does! 😭
Because scrolling horizontally to see the entire line is annoying.
use a smaller font size
edit: and break bracketed code into multiple lines for clairty anyway
Skill.. i mean Screen Issue
Also use word-wrap
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.
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.
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
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.
I learned to program on ZX Spectrum. All variables were one character long.
There are two bothersome problems in software development:
The off-by-one errors increase significantly when you program in Lua