I must use this in a commit!
As for variable names I think I haven’t done any worse than what was already mentioned. As for Git commits however, I remember having a frustrating day once, where I just couldn’t get around a problem and had commits like this:
- Fix to the problem where the screen didn’t get updated
- Another attempt to fix the problem where the screen didn’t get updated
- For sure this will fix the problem where the screen didn’t get updated
- This better work this time, NOW the screen will get updated
- For f*cks sake, just kill me!
final commit being: And this time, I mean it?
Something like that indeed.
My go to name if I can’t think of soemthing to name it is:
(___ is a something vague)
___Thing
IE
ShooterThing()
I usually write this first, think for a sec and change them but sometimes I have to move on with the code and have to remember to come back after i get what i need to call it.
Maybe my go to name should be w/e i google for it hahaha.
My worst variable names occurred when I first started learning coding in high school.
I don’t remember the assignment but I remember the variable names:
- which1
- which2
- which3
- whichoneiswhich
I definitely learned my lesson after writing the program.
A few years ago, I was contributing part of a Unity runtime thing for an animation tool, and I named one of the classes Smart____. And it made it into the official package. It was a wrapper for one of Unity’s built-in classes, adding extra functionality to it.
Every now and then, I still look back and regret the name. I think Smart____ is a bit of a copout and too vague/insufficiently descriptive and just slightly presumptuous.
But at the same time, I still don’t know what would’ve been a better name. ___Wrapper is just as bad?
Maybe I should’ve added an adjective, describing what it did or contributed to the thing it wrapped. Tracked____. Accounted____.
I’m not sure what the specific wrapper was for, but judging from your descriptions… perhaps _____Tracker?
The worst commit messages I have come across while using git is 6 consecutive commits, all called “Stuff”
I have a project with “numerous bugfixes” commits one after the other, and I know better.
These are my goto’s in a pinch
var xxx = ....
var zzz = ...
Some examples of bad habit git commits I often write:
“Try again”, “Fix”, “Will this work?”, “kjdaskdhksdsa” (keyboard smash)
I almost always squash my branch changes before committing to the main branch (with a better commit message!) though so I feel like the bad messages can be excused
My script names are much worse than my variable or git commits…
I try to make a whole description on what it does in the titles…
I mean, what even is; RustyEnemySpawnerLocationUpdater.cs
The wors commit “I do something, don’t remember what… wanna sleep((((”
In my earlier work I would make a PlayerMovement class only to realize later that I was also going to use that same class for enemy’s movement.
My early commits were pretty bad too. Was lucky if I put a full sentence.
Here’s my worst commit message
Not a variable name, but several years ago I was fiddling with stereoscopic images and such and I had a function that would generate an anaglyph from two stereo images. The function was called AnaglyphSkywalker
commits in my current project:
It’s variable and function names like these that lead one to the Dark Side of the Code…
I remember the days when it was ALL dark theme. Black background and white, green, or yellow foreground!
Then the Mac came along and put black text on white. An abomination!!! But it caught on.