1 point

Older C compilers would truncate a variable name if it was too long, so VeryLongGlobalConstantInsideALibraryInSeconds might accidentally collide with VeryLongGlobalConstantInsideALibraryInMinutes.

Legend says that they used to do it after a single letter with Dennis declaring “26 variables ought to be enough for anyone”.

permalink
report
reply
1 point
*

FullSentenceExplainingExactlyWhatItDoes(GiveThisVariable, SoItCanWork)

permalink
report
reply
1 point

permalink
report
parent
reply
1 point

I worked with a developer who insisted on using the shortest names possible. God I hated debugging his code.

I’m talking variable names like AAxynj. Everything looking like matrix math.

permalink
report
reply
1 point
*

Ah, must’ve been a fortran developer. I swear they have this ability to make the shortest yet the least memorable variable names. E.g. was the variable called APFLWS or APFLWD? Impossible to remember without going back and forth to recheck the definition. Autocomplete won’t help you because both variables exist.

permalink
report
parent
reply
1 point

And you can write more than six characters, but only the first six are recognized. So APFLWSAC and APFLWSAF are really the same variable.

And without namespaces, company policy reserves the first two characters for module prefix and Hungarian notation.

permalink
report
parent
reply
0 points

He did write some Fortran in his past! What made you think it was Fortran influence?

permalink
report
parent
reply
1 point

72 characters per line/card.

permalink
report
parent
reply
1 point

Then you realize your code is undebuggable because half the functions and variables have single-letter names or called foo, bar, baz, etc.

permalink
report
reply
0 points

I have a somewhat related real world story. I had a client that was convinced that tons of people were going to decompile their application and sell their own version of the program, so they insisted that they needed their code obfuscated to protect company secrets and make it harder to reverse engineer. I tried explaining to them that obfuscation wasn’t that big of a deterrent to someone attempting to steal code through reverse engineering and that it would likely cause some issues with debugging, but they were certain they needed it. Sure enough, they then had a real user run into an issue and were surprised to find that their custom logging system was close to useless because the application was outputting random obfuscated letters instead of function and variable names. We did have mapping files, but it took a lot of time to map each log message to make it readable enough to try to understand the user’s issue.

permalink
report
parent
reply
0 points

This is why you obfuscate after you code. Just obfuscate the release build. And logging may at that point be thrown out of the window anyway

permalink
report
parent
reply
0 points
*

It was obfuscated only in the release build. The issue is that they have a system to send certain logs to an API so they can refer to them if a user has an issue that needs further investigation. Unfortunately, their target audience is not very tech literate and have a hard time explaining how they got into a situation where they experienced a bug, so the remote logging was a way to allow us to try to retrace the user’s steps. Some of the logs that get sent to the API have JSON values converted from class data, will refer directly to class names, etc, and those logs had the obfuscated names.

permalink
report
parent
reply
1 point

name your function as malloc() and see to world burn and generate bugs at factorial rate.

permalink
report
reply
1 point

If you name it malloc it will be easy to notice. On the other hand if you call it free…

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 2K

    Monthly active users

  • 861

    Posts

  • 14K

    Comments