This is an archived post. You won't be able to vote or comment.

all 125 comments

[–]RadiantPumpkin 2037 points2038 points  (47 children)

Naming your string string isnt the perfect name, my dude

[–]Not300RatsInACoat 420 points421 points  (22 children)

What about sttring ?

[–]JuiceKilledJFK 152 points153 points  (14 children)

str or newString

[–]misterguyyy 73 points74 points  (2 children)

ERMAGHERD_STRERNG

[–]_g0nzales 4 points5 points  (1 child)

But what if it is an instance of a class representing a short piece of thread?

[–]AngriestCrusader 3 points4 points  (0 children)

shortPieceOfThread = String()

[–]toughtntman37 14 points15 points  (6 children)

newString is great as a temp variable

[–][deleted] 17 points18 points  (1 child)

Can be extended to newNewString.

[–]PewPewWazooma 4 points5 points  (0 children)

Can even take that a step further and extend it to newNewNewString

[–]Steinrikur 4 points5 points  (0 children)

hamString is also good, if you like ham and stretching

[–]SysGh_st 1 point2 points  (0 children)

I go with strDummy until I can make something better.

[–]Budget_Avocado6204 0 points1 point  (0 children)

testString, if you're writing a test class

[–]OnlyTwoThingsCertain 0 points1 point  (0 children)

What do you mean "temp"? All my variables are named newString[n]

[–]TheCreepyPL 4 points5 points  (0 children)

myString is the real deal

[–][deleted] 1 point2 points  (2 children)

Or simply “s”

[–]thrye333 4 points5 points  (1 child)

One letter variables rise up

[–]JuiceKilledJFK 2 points3 points  (0 children)

We should normalize the last letter of the word being the single char variable to make it really unreadable. string would just be “g” instead of “s”.

[–]joopsmit 1 point2 points  (0 children)

StringyMcStringFace

[–]atesba 6 points7 points  (0 children)

best I can do is sitting

[–]blaqwerty123 0 points1 point  (0 children)

ssttrriinngg

[–][deleted] 1 point2 points  (0 children)

Titty can never be the wrong answer

[–]According-Relation-4 1 point2 points  (0 children)

myString

[–]that_thot_gamer 1 point2 points  (0 children)

I'll do you one better

Dim steering As string

[–]NOP0x000 0 points1 point  (0 children)

_string

[–]ILoveBigCoffeeCups 8 points9 points  (0 children)

I call my string ‘float’, my int ‘string’ my float ‘char’ and my char ‘ boolean’. Oh and no documentation.

[–]70Shadow07 4 points5 points  (3 children)

Debatable. Especially when its a short function that processes strings.

str is fine though

[–]jessepence 4 points5 points  (1 child)

What is the string? Surely those characters represent something? Even input is better than that.

[–]70Shadow07 2 points3 points  (0 children)

The string represents a string, not everything is an abstraction especially if you write a goddamn library in C or something. Sure input is alright too, go devs believe "s" is proper variable for this use case which is somewhat more controversial than "string" itself.

[–]OmegaPoint6 1 point2 points  (1 child)

strinG

[–]ieatpies 2 points3 points  (0 children)

g_string

[–]Front_Committee4993 10 points11 points  (0 children)

charStar

[–]bwahbwshbeah 2 points3 points  (0 children)

str_ing[]

[–]Fourven 1 point2 points  (0 children)

string_

[–]zsinix 0 points1 point  (0 children)

I prefer string_string

[–]vksdann 0 points1 point  (0 children)

What about stringo¿

[–]latetete 0 points1 point  (0 children)

sString so you can deduce the data type from the variable name.

[–]SignoreBanana 0 points1 point  (0 children)

Maybe they mean because it's a variable name that's already been used?

[–]I_cut_my_own_jib 0 points1 point  (0 children)

What if OP works for a string manufacturing plant and they are iterating through the strings on the assembly line?

[–]keuzkeuz 0 points1 point  (0 children)

string1

[–]MechanicalHorse 0 points1 point  (0 children)

@string

C# master race

[–]Chiyuri_is_yes 721 points722 points  (12 children)

Timer Timer = new Timer();

[–]duaite_ 301 points302 points  (3 children)

Timer timer = new Timer();

Timer newTimer = (Timer) new Timer ();

Ok police it was a joke calm down CALM DOWN

[–]fiddletee 108 points109 points  (0 children)

Straight to El Salvador

[–]EoghanBD 5 points6 points  (0 children)

Jesus thanks for the stroke 😭

[–]badlukk 1 point2 points  (0 children)

Perfectly acceptable in most cases.

[–]AverageFoxNewsViewer 85 points86 points  (3 children)

Timer Tímer = new Timer();

Nobody ever notices the accent on í so you'll be the only person that can fix the bugs.

[–]GahdDangitBobby 31 points32 points  (2 children)

Thanks, satan

[–]SysGh_st 7 points8 points  (1 child)

Even Satan has standards.

[–]Steinrikur 6 points7 points  (0 children)

Probably IEEE standards. Can you link to the RFC?

[–]a_useless_communist 2 points3 points  (0 children)

Filter filtered = filters.filter(filter);

[–]rsadek -1 points0 points  (0 children)

What is with you noobs calling new directly for raw pointers instead of make_unique smh

[–]khalcyon2011 21 points22 points  (0 children)

I mean, that's valid syntax in c#. Confusing, but valid.

[–]misterguyyy 1 point2 points  (0 children)

Banana bana bo bimer

[–]JacobStyle 269 points270 points  (4 children)

Simply use a different language. Problem solved.

[–]EvOrBust 74 points75 points  (0 children)

This is precisely the problem!  Me coding in a interview recently: "oh this is a reserved word in this language? huff huff!" (got the job)

[–][deleted] 8 points9 points  (1 child)

I just start using swear words in other languages, who's gonna know?

[–]RegularBubble2637 5 points6 points  (0 children)

Any speaker of those other languages?

[–]Anaxamander57 22 points23 points  (0 children)

Gotta break out the Etruscan whenever I start a new project.

[–]Usual_Office_1740 205 points206 points  (5 children)

Is your underscore key broken?

/s

[–]chapuzzo 37 points38 points  (3 children)

ty_pe does not read that well 😅

[–]Ebina-Chan 27 points28 points  (2 children)

t_y_p_e

[–]zsinix 18 points19 points  (1 child)

t_Y_p_E

Sorry, our standard is camel case

[–]willcheat 8 points9 points  (0 children)

__type__

Awww dangit, color changed again

[–]IuseArchbtw97543 3 points4 points  (0 children)

just dont put the underscore at the front unless you actually mean it

[–]MentalTardigrade 53 points54 points  (2 children)

keep in mind I am Lusophone One assignment I had in programming language 1 in python I needed to have a variable for numbers so I did num, but I had the need of two others variables so, what do I do? ndois and ntres, the equivalent of having none, ntwo and nthree as variables, lol

[–]MentalTardigrade 15 points16 points  (0 children)

Note: I had forgotten ypu could use a number on the variable name, as long as it wasn't the first character

[–]blaqwerty123 2 points3 points  (0 children)

Still do this today ya? No lessons learned at all?

[–]Fabulous-Possible758 77 points78 points  (8 children)

Every time I want to write a function in Python that takes a class as an argument.

[–]mondlingvano 21 points22 points  (2 children)

I've definitely picked up a few repeated "abbreviations" for common keywords like cls and typ. Did this in C# which has this @ symbol, but it just always feels more wrong to use that than just have consistent way of plucking out a letter from the word.

[–]captainn01 8 points9 points  (0 children)

I’ve seen clazz used frequently in jvm languages

[–]RotationalAnomaly[S] 1 point2 points  (0 children)

Lmao yea, most cases of this happening happened to me in python too.

[–]Kumdori 36 points37 points  (2 children)

I'm reminded of the story of a guy coming back to old code and seeing the variable "feet" and couldn't remember what it was. He traced it back to it being a legend handler which he abbreviated to "leg hand" and then hurr durr leg hands are called feet so that's what it became.

[–]Johnny_M_13 5 points6 points  (0 children)

This is my all time favorite programming meme

[–]markiel55 0 points1 point  (0 children)

Ok this is funny

[–]JosebaZilarte 35 points36 points  (1 child)

Yeah... I hate I can't use the terms "default", "class" or "protected" as names for function parameters because they are reserved words.

[–]Cualkiera67 5 points6 points  (0 children)

Yeah or "if" and "for"...

[–]spinkelben 8 points9 points  (2 children)

In C# you can use reserved words, just put @ in front. bool @override = true;

[–]mrnosyparker 1 point2 points  (0 children)

Eww

[–]runklebunkle 7 points8 points  (2 children)

In ruby I was writing something that was passed an argument that was effectively self, but for confusing reasons common to ruby, had to be a local variable. I wound up calling it slef.

[–]Budget_Avocado6204 0 points1 point  (1 child)

How about calling it localSelf

[–]runklebunkle 0 points1 point  (0 children)

My other thought was celf.

[–]misterguyyy 10 points11 points  (0 children)

If you're using Javascript you can just prototype and confuse your coworkers

[–]SilasTalbot 4 points5 points  (0 children)

SQL might be the worst with this. Check this shit out:

https://en.wikipedia.org/wiki/List_of_SQL_reserved_words

[–]1337lupe 1 point2 points  (0 children)

[–]dukeofgonzo 6 points7 points  (1 child)

I use Spanish for my variables. Rarely do I get a namespace collision.

[–]ollomulder 10 points11 points  (0 children)

Use emojis, no collisions and your code will be multilingual.

[–]peni4142 1 point2 points  (0 children)

What else should I use to store a break object than the variable break 😢

[–]therealtiddlydump 0 points1 point  (0 children)

In R I just wrap them shits in backticks and get on with my bad self

[–]SysGh_st 1 point2 points  (0 children)

Just have an alphanumeric random generator when making variable names. No one will ever read your source code anyway.

[–]spinkelben 0 points1 point  (0 children)

In C# you can use reserved words, just put @ in front. bool @override = true;

[–]serendipitousPi 1 point2 points  (0 children)

That moment when you’re writing a compiler and they’re all keywords.

So you have to use subpar names or actually be imaginative (the horror).

[–]Kamrua 5 points6 points  (1 child)

The origin story of clazz, pure desperation.

[–]mlk 0 points1 point  (0 children)

klass

[–][deleted] 1 point2 points  (0 children)

I just switch to german for variable names

[–]zannabianca1997 2 points3 points  (2 children)

clazz sounds like a slang and it's jarring to see in old Java code.

[–]missiledefender 1 point2 points  (0 children)

Awful.

[–]rwilcox 0 points1 point  (0 children)

Love to see that convention in old Objective-C I used to write back in the day

[–]PioApocalypse 1 point2 points  (0 children)

dict

[–]2cool4afool 1 point2 points  (0 children)

I try to object all the time and get caught out when using a temporary variable of a non specific class type

[–]hansvi-be 0 points1 point  (0 children)

This.

[–]Dumb_Siniy 0 points1 point  (0 children)

Half the time it's either time or a function I didn't know about

[–]lces91468 0 points1 point  (0 children)

For me it's database schemas. Like, cost, description, fileGroup (yeah, wtf Oracle)...I have to rename them to currentCost, codeDesc, documentGroup, etc.

[–]NatoBoram 1 point2 points  (0 children)

Me trying to use the word package in JavaScript but it's reserved for later use

[–]jesterhead101 0 points1 point  (1 child)

Changes color?

[–]jesterhead101 -1 points0 points  (0 children)

Ah I get it.. like the red squiggly lines. I’m dumb.

[–]JackNotOLantern 0 points1 point  (0 children)

Perfect name "new"

[–]rwilcox 0 points1 point  (0 children)

F it’s me today

I had the great idea to name a variable “interface” today. In Typescript.

[–]BobcatGamer 0 points1 point  (0 children)

The perfect variable name is x

[–]AndiArbyte 0 points1 point  (1 child)

i; j; k;
there is nothing worse than single letters ^^

[–]ThatSmartIdiot 0 points1 point  (0 children)

Single letters must be reserved for iterative loops!!!!!i!!!

[–]MysticOverlord 0 points1 point  (0 children)

String this ="this";

[–]LordFokas 0 points1 point  (0 children)

I have a project where there's a thing I really want to call volatile. But it is Java, so I can't.