5 ms·
I love the variable names. I definitely had the same naming conventions as a kid :) Funny story. Sophomore year at college, I worked at a dev shop, and I was t
by xyzelement 4y ago
I love the variable names. I definitely had the same naming conventions as a kid :)
Funny story. Sophomore year at college, I worked at a dev shop, and I was the first person to set up version control there (CVS... it was like year 2000.) The next day I reviewed changes that were merged and variables $tit and $ass were all over the place.
I assumed the guy who checked it in was just immature and met w him to "professionalize" him. But turns out these variables referred to Titles and Assignments (it was staffing software). LOL!
- belthesar 4y agoAs a kid? When writing stupid scripts, I frequently use `fart` as a variable name to this day. I'm a staunch supporter of naming variables intentionally in software that lives, but I'm definitely not above doing a `fart=True; while fart: ...` in temporary repl work. Maybe I'm just eternally 10 years old, haha.
- rootusrootus 4y agoHeck, when I write throwaway scripts most of my variables are different slang terms for feces. Sure, I use foo, bar, baz, bing sometimes too. But I never grew up either. At some point I decided that was a Good Thing, and I have no further plans to mature.
- taylodl 4y agoI must be old-fashioned! My variable names in throwaway programs tend to be x, y, and z and my iteration variables tend to be i, j, and k.
- deleted 4y ago[deleted]
- noboostforyou 4y agoSame (did you start learning programming with C?). i++ is pretty much hardcoded into my brain.
- craigkilgo 4y agoEveryone doesn't use i,j,k for counting variables?
- tqwhite 4y agoYes. At least all decent people.
- jasonhansel 4y agoHuh. I tend to use the first letter of the type, so "s" for a string, "d" for a dictionary, etc. Then "s2," "d2," etc. if there are more than one.
- SoftTalker 4y agoWhen I learned programming the BASIC variant I used only supported two-character variable names. And even where longer names were allowed, the text of the program consumed memory so you could optimize by keeping variable names as short as possible. So I had the habit of using single-letter variables for quite a while. I still use them as loop counters, or in small functions where the scope of the variable is maybe a few lines of code and completely unambiguous. In such cases I think long variable names are distracting.
- qolop 4y agoMy foo is "yo" and my bar is "ho"
- volkanvardar 4y agoMine are: x, xx, xxx, xxxx...
- laylomo2 4y agoMine are just whatever happens to be under the keyboard layout I'm using at the time. If qwerty, then `asdf`, `qwer`, `uiop`, `zxcv` are likely to be temp variable names. But since I've dabbled in other layouts, I've found the names have changed to: - Dvorak: aoeu, htns, gcrl, mwvz - Colemak: arst, neio, qwfp - Mtgap: inea, htsr, dlcw, fvgj etc...
- andai 4y agoIn college, usually a few minutes before an assignment was due, I'd frantically Ctrl+F the project for various curse words.
- olav 4y agoNice. I vividly remember the days, sometimes in the 80s, in some university cellar, hacking away at our green-lit vt terminals connected to some vaxens, that one of the other regulars in the room and I used temp variables _hudli_ and _tralla_ as some kind of ritual.
- olav 4y agoAh, "hudli hudli" stands for "Extraordinarily fast guitar playing" https://www.urbandictionary.com/define.php?term=Hudli https://www.urbandictionary.com/define.php?term=Hudli - it's only now that I look this up
- dark-star 4y agoheck, in MY time, variables could only have 2 (significant) letters, so we were stuck with "hi", "jk", "ah" and things like our initials.... The good thing is that since only 2 letters were significant, the variables "fa", "fart", "fan", "fall" etc. were all treated the same, which could cause some confusion to people not familiar with the intricacies of C64 BASIC ;-)
- ExtremisAndy 4y agoAre you serious?! That is so hilarious to me, because I do the same thing! And I am always so terrified that I will get an interview, and they will want to see a sample of my code, and I will have forgotten to take out all the bits of juvenile humor that are scattered through the code of my personal projects!
- xyzelement 4y agoI actually try to not do that now. As they say, programming is the art of naming and I think forcing myself to think about what a variable is (and then using that name) leads to better outcomes. Agree for throwaway work it may not matter but I try to keep myself disciplined anyway. A good example is say I am doing an advent of code and the temptation is to treat it as throw away code. But the reality is, sometimes I put it down and come back to it, and having variables like fart doesn't really help snap back into the context. Not saying this is an absolute but I find it a general rule of thumb for myself
- jrootabega 4y agoIn a class where we were writing a parser for math expressions, this was my plausible deniability scenario when I named the functions whose job was to analyze characters. Looking back, I'm sure the teachers were not at all amused.
- Mawr 4y ago"I got fired over a variable name...." - https://old.reddit.com/r/cscareerquestions/comments/dpcfns/i_got_fired_over_a_variable_name/ https://old.reddit.com/r/cscareerquestions/comments/dpcfns/i...
- Vaslo 4y agolol nice find
- metadat 4y agoThe linked "dog story" is an.. eye opener, too: https://old.reddit.com/r/cscareerquestions/comments/95dgrx/i_am_absolutely_mortified_and_embarrassed_beyond/ https://old.reddit.com/r/cscareerquestions/comments/95dgrx/i...
- chewxy 4y agoSurprisingly I did get pulled into a meeting with the CEO and a sales/custcare guy because of a similar issue. I wrote functions that are available for the users to use (they can customize their own dashboard). Our function conventions are camelCase. The function I wrote was something along the lines of `cumOnMetric` or something like that. Needless to say some square somewhere thought this was a joke and didn't like it. So there I was, just blinking away and wasn't even aware this was something sensitive. It was funny sure, but I didn't have the idea that it was "unprofessional". I still feel the idea of professionalism is quite a club thing. But yeah we got our first snake_case function name because of that.
- ikornaselur 4y agoI don't see how the casing matters here? Would `cum_on_metric` somehow be better?
- sakras 4y agoAs a kid my dad told me that I could name my variables whatever I wanted. I still remember the confusion on his face when he saw “int iPod” and “string xbox” all over my code.
- xyzelement 4y agoI lied! It wasn't CVS... It was Visual Source Safe!
- nfw2 4y agoI can't imagine anyone accidentally naming their variables $tit and $ass and not realizing it. I expect the guy thought it was funny, and the domain gave him some plausible deniability.