What is your variable name of shame?

I think my worst (Out of all my probably already terrible variable names) is either italianGravity or gun.
But only because I usually I don’t like to name things in vague terms so these two are just exceptions to me. Italian referring to Mario and gun referring to the position in which to summon fireballs

I started on a TRS 80 Model 1 (Tandy Radio Shack). Their variables were restricted to 2 characters max, 2 characters w/ $ if it was a string. I confused people because I always started my code at line 110 instead of 10. I reserved the first 100 lines for REM statements to comment my variable names.

1 Like

I choose a single letter at random.

Worst commit message is “commit”

1 Like

Lately I’ve been naming all my ray variables as a famous ray:

Ray rayMondBlanc =
Ray rayBradbury =
Ray rayWilliamJonhson=

You get the point… I honestly don’t know why I’m doing that, I just find it hilarious that later, when trying to debug I get all confused “What the … is a rayMondBlanc?”. My own confusion amuses me.

The abomination of coding sorting algorithms as junior developer xd

  public static void BubbleSort(int[] a)
  {
    for(int i = 0; i < a.Length; i++)
    {
      for(int j = 0; j < a.Length - 1; j++)
      {
        if(a[j] > a[j + 1])
        {
          int temp = a[j];
          a[j] = a[j + 1];
          a[j + 1]  = temp;
        }
      }
    }
  }
 

The good old bubble sort. Had to use that in Basic.

@Yee - That is not really a bad idea. If you look through most of my C++ or VBA code the first part of the variable name is the type of variable. That is called Hungarian notation. I use that and lowerCamelCase for the names as well.

Worst message in commit:

I use it all the time in my own repos

Like I’m gonna remember 6 months from now what bug I was trying to fix. Not to mention that I’ve never had to restore past one or two commits back in which case the bug was still fresh in my mind…

Might be different if I had a team but alas, it’s just me.

lol. Take your pick:

(In my defense, because these are persistent data, I had to obfuscate what everything was in the .dat file. (I also did a hash of the file whenever the persistent data was updated.). All of these have getters and setters that are fully defined (Like: public bool Is_Right_Hand_Controls)

private int _gS;
private bool _mRM;
private int _mRMC;
private int _sI;
private bool _iOSC;
private bool _iGC;
private bool _iMP;
private bool _iSP;
private bool _iVP;
private float _vM;
private float _vS;
private float _vV;
private bool _iRHC;
private bool _iP;
private long _bET;
private int _sCT;
private bool _iLU;
private int _lSC;
private int _nLI;
private bool _sHTP;
private int _hSP;
private int _hST;
private int _hSSP;
private int _hSST;
private bool _hSPBM;
private int _sPBM;
private int _sPBMT;
private long _sPBMET;

I think a better mechanism for obfuscating data files is to run them through some form of encryption. Encrypt the data before saving it, then decrypt it when loading it in. Could save you a lot of headaches when debugging with data names like that (VSC’s Debugger would only have the _iRHC value, not the Is_Right_Hand_Controls).

1 Like

I did, eventually, end up doing just that.

v1 shipped with this horrible abomination
v2 shipped with an encrypted dat file to store permanent data (There were 3 or 4 “save file” updates that caused me to write “save file converters” for and it was all because of this horrid obfuscation method.)
I saved the classes from v0.x and 1.x as a reminder of what NOT TO DO EVER AGAIN! :joy: :rofl:

My variable name of shame is newVariable. My worst commit for git is Something changed I think ? I have even had some strange cache probs in my script, my latest one is a bool canJump.

1 Like

Not really a bad variable name funny but, I worked on a mobile port of Sonic The Hedgehog 2. We had access to the 86k Asm source code which somebody had commented in Eng-rish. The funny part was the propeller on Tails biplane had been commented throughout the code as properror with Rs instead of Ls.

I’m guilty of commit messages that are less than explanatory, but one I will always remember simply said “Refactor” in which a massive refactor was done including changing the logic of some code I had written from working to missing an edge case I had explicitly coded for.

In terms of variable names, the one that annoys me most that I still do anyway is a boolean name that is ambigious to whether it’s true. Saves me maybe 10 seconds in terms of thinking of a decent name, but can cost me a lot more in terms of readability months later.

This isn’t my variable name of shame but the first big project I worked on was a Discord bot written in python with another person.

There was one function that did quite a bunch of stuff with our Sqlite DB but it was breaking at some point so what they did to debug it was wrap everything in try/except blocks and if statments.

basically doing:

async def func(ctx, discord_id=None, vrc_id=None):
    done = False
    f***ed = False # Yes we used the actual curse as a bool here
    if discord_id is not None and vrc_id is not None:
        discord_id2 = discord_id # these "name"2 variables where only used once each in the origional function and in places where they where not needed, no idea why we had these here anymore
        vrc_id2 = vrc_id
        try:
            # DB code here
            done = True
        except:
            f***ed = true
       if done is False and f***ed is False:
           # This kept going, nesting basically this same patern over and over 

in that same bot we had some lovely function names such as

  • my_file
  • anti_pog
  • output1-9 (all 9 outputX variables where in the same function too)
  • sh*t_list (A list of funny reply messages)
  • pewpew

I eventually rewrote that entire bot in Rust a year or two later and now it’s clean and much more managable but those where some dark days lmao

Privacy & Terms