tags:

views:

1291

answers:

37

I was reading through my daily doze of RSS when I noticed a link to the python compiler documentation where class names like assList, assName and assTuple exist. While starting names with 'ass' is perfectly acceptable to me, it just sparked this idea that there probably exist much better examples of this.

Have you personally used or otherwise encountered any inappropriate function or variable names?

Personally I have used 'crap' and 'moo' for temporary purposes, forgot them and at a later point they came too integrated for me to bother with fixing them.

+35  A: 

I could not help smiling when I encountered:

def anal( self, CFG ) :
  self.do_anal_dominate( CFG                        )
  self.do_anal_frontier( CFG, CFG.get_flow_header() )

It's about analyzing control flow graphs as part of a compiler...

Martin Geisler
+1 for sheer entertainment! LOL..
Swanand
Anal, the final frontier.
Ólafur Waage
Reminds me of our database: Annals Extra -> tbl_analsex
Mike Robinson
+1  A: 

I used names like:

  • shit
  • dontMessWithTheBest
  • killEmAll
  • shutUpCompiler
  • sux
  • meSucks fooSucks, youSucks, *Sucks
  • aName
dfa
+1  A: 

CWaitCursor wc;

GetViewImage(), which was actually not returning an image handle, but saving the current image on disk. In one sense, ok, you were getting the image on disk, but experienced programmers usually call such functions "Save...()".

Jem
+20  A: 

Theere was this function:

public void doNotCall() {...}

And

private bool Punch(Employee e)

The prefix stood for "false checkbox"

 bool fckMan
 bool fckWoman

Edit:

Just ran across this SQL:

select ...
where finite = 1 and infinite = 1

This select actually returns a bunch of rows. Apparently, SQL > number theory.

Edit 2:

To show again how engineers love contradictions:

class DynamicStaticDataManager {
Jeff Meatball Yang
+2  A: 

While doing contract work for another company, they ran some kind of tool to check the submitted code that choked on our use of the Microsoft defined Shell Item ID struct or SHITEMID

Chris Becke
+4  A: 

I wrote A.R.S.E. (Advanced Reusable Site Engine) and used arse as a prefix for all vars. Also S.H.I.T (Superior Human Interface Tools). Luckily neither system is open-source.

SpliFF
My university dissertation was the "Advanced Redundant Server Environment"...
Rowland Shaw
+14  A: 

i saw somewhere in some old code:

if (isFalse == true)
    // code
24x7Programmer
+7  A: 

From one of our view functions in Django:

    sorts = {
    "date": lambda direction: "%spublished_date" % ("-" if direction=="desc" else ""),
    "reads": lambda direction:"%shit_count" % ("" if direction=="asc" else "-"),
    "comments": lambda direction:"%snum_comments" % ("" if direction=="asc" else "-")       
}
I lol'd at `%shit_count`.
musicfreak
+6  A: 

Anything postfixed with 2 (3,4,5..) or New/Old is most annoying.

Rune Sundling
Disagree. It's a fine strategy. The entire COM versioning uses this approach with numbers.
Developer Art
+18  A: 

Who hasn't used this before:

On Error Goto HELL

HELL:
rein
+1  A: 

I worked with a designer who had... well .. issues. I found this and others like it in at least three HTML templates he had worked on:

<p>
Please click on an option below to choose the package you want. 
Each package offers it's own beneficial moose, 
if you can't find a moose to suit your needs, go f**k a dead moose.
</p>

When I queried him on it he said he puts it in files he's working on so he can search for them later and finish them. Suffice to say he never did.

SpliFF
I found that very offensive. Mostly because he used "it's" for "its."
Nosredna
I mean, what's the problem with grammar and (I guess) americans? it's basic grammar the distinction between it's and its (and the same with your and you're). I've never made this mistake during my English classes, and I'm Italian, so by definition my English sucks, but on the net it's a constant.
Stefano Borini
Stefano, for us non-native speakers is easier because we learned as adults (or grown-up kids), from books. For native speakers, they learned those basic terms first from hearing them, and then at school, so they may remember more the way the words sound, rather than how they're written. Totally unrelated: my surname is Borio, and it's italian too.
Petruza
+1  A: 

A fortran variable for isotope calculation read "CylindricalSquare=...

LarsOn
I think I've encountered that somewhere also. AFAIR, the "square" part is ment in the term of exponent (**2). But still sounds weird when you see it :-)
ldigas
A: 

foo

-.-

cwap
+8  A: 

int onehundred = 200;

(Of course, it started as 100, but appeared too little);

xtofl
Just to prove the name for the symbolic constant is also important.
Gamecat
+1  A: 
 bool IsNot=true;
Akashya
+8  A: 

For years (as long as I can remember and I'm 44) programmers have been using foo and bar as function or variable names in example code and we all know what they mean.

This is worth looking at - swear count in the Linux Kernel:

http://www.vidarholen.net/contents/wordcount/

malcolmm
+16  A: 

I worked for a summer as an intern in a computer game development studio while studying. One of my tasks was to improve the performance of an exporter for animated 3D vertex data from within Alias|Wavefront Maya. The version of the script the were currently using was written in Maya's MelScript language and was atrociously slow, requiring the animator to get up and have a cup of tea for half an hour every time he wanted to export more than 10 frames of a character with more than 10 animated vertices. There was no way to speed up the script as written, so I was going to have to dive into Maya's C++ API, which was at the time very poorly documented with scant few examples.

Now, Maya has a remarkable plugin architecture that allows any data input in the scenegraph to be plugged in to basically any data output anywhere else in the scenegraph. This means that, at the C++ level, there are many levels of abstraction to get from a high-level object representation to the raw vertex data that I was interested in. At the time I was a computer science undergrad, and this was my first real job of any kind. So, I was navigating structures I had next to no understanding of, built with an amazingly complex plugin architecture the likes of which I had never used before.

Having got the base plugin stuff compiling and not crashing, I spent the next several days navigating the dense graph structure to locate where I thought the vertex data might be, then hit a brick wall of epic proportions. From memory, I had to get something called a Plug to the value, which then needed to be Adapted somehow, which gave me back another kind of Plug which I then had to dereference several times to reach a pointer to a pointer to an array of pointers to actual vertex data. And at the time, I hadn't actually quite grasped what a pointer meant.

After spending 16 frustrating hours on the four lines of code that did this, the variables names had morphed from sensible things like Plug thePlug to Plug* adaptedPlugFromPlug to Plug adaptedDereferencedPlugFromPlugArrayMaybe to Vector* iDontUnderstandAnymore to Vector* JUSTCOMPILEYOUMOTHERF--KER, and so on. The end product was a function where the variables were named, in order, sh-tsh-t, f-ckf-ck, c-ntyc-nt and f-cksh-tf-ck. When it finally worked, it worked stunningly well, exporting in 5 seconds flat what used to take a full 30 minutes. To the company's credit (or not), they only cared that it worked, and didn't review the code any further; and to this day, as far as I know, these variable names persist in their CVS repository.

damian
A search on TDWTF would be appropriate to see if anyone found that gem :)
Damir Zekić
+1  A: 

I once saw some code from a guy how was lazy about naming variables, so he named them like:

var
  A, B, C: string;
  X, Y, Z: Integer;

I guess he understood what he was doing at the moment, but nor him nor anyone else could understand his code later.

Luckly he was an intern which just stayed for a couple of days, until people started to saw his code and fired him.

Every time somebody stepped into his code they just deleted everything and wrote all again from scratch.

No, they didn't use source control, nor had code reviews, they just shared a network folder where everyone changed everything right there, I bet that some of this guy's code are still there :)

Fabio Gomes
A: 

Not too exciting, but when I was a developer at the school I attended I came across a little tool that made SQL dumps, writing out to a file named "dump.shit".

Cory Larson
A: 

My all time favorite variable name that I've seen is:

int capitalX=0;

ssteidl
A: 

My favorite is:

if (loadObjectFromDatabase(obj)) {
 //Figure Out what to do
}

This method was actually causing a big bottleneck on the database because of not using indexes and when we drilled down finally to the place where it is called from, we were shocked to see the comment

Arvind
+11  A: 
bool shit; // sorry shift
bill
+5  A: 

Not a function name but I saw code like this once that passed the spellchecker but uhm... yeah not quite.

function doStuff(data, witch){
  if(witch == 'customer'){
    //...
  } else if(witch == 'employee'){
    //...
  } else if(witch == 'distributer'){
    //...
  } else {
    //...
  }
}

There were several checks against the witch but none were like what I was expecting... canDrown(witch), isGoodWitch(witch), isSheAWitch(witch) or burnHerAtTheStake(witch) ;-)

scunliffe
Don't forget `isSheMadeOfWood(witch)` and `doesSheWeighTheSameAsADuck(witch)`. :)
Bill the Lizard
If this were written in Python, I think it would have been just a tad more epic. ;)
musicfreak
+3  A: 

When I was a TA helping grade ML programs, the students quickly realized they could name the methods whatever identifier they pleased rather than use the signatures the professor gave. In brash attempts to get better grades, they came up with names such as:

fun chetIsHot() = let....end;
Chet
Now the question is, did their efforts to get better grades work, Mr. Hotness?
Chris Lutz
Not in the least. Cute, but doesn't contribute to correctness.
Chet
+1  A: 

I wrote some code once that automatically sent email to $perf_anal under certain circumstances. I don't think the performance analyst was too thrilled with that variable name.

Graeme Perrow
A: 

GetEcks()

a function in a codebase for a PS3 title I worked on to check the state of the X button on the controller.

Andrew Khosravian
+1  A: 
for(pete=1 ; pete<max ; pete++) {
    if( pete==1 ) {
       // Some lines stuff to do with the first pete
    } else {
       // Some lines stuff to do during the rest of the petes
    }
 }

The thing is that in spanish pete means blowjob.

The Disintegrator
+1 Thanks bud ... my wife is spanish, and I've been trying to learn some good swear words for years. I can't wait to see her tonight. ;-)
John MacIntyre
jejeje you're welcome. By the way. I don't know if in spain they use this term. As far as I know is a latin american slang.
The Disintegrator
Actually I though pete was used only in Argentina. Pete comes from Chupete, which means Pacifier.
Petruza
A: 

Well there was always the project I worked on that had

public void doIt()

and

public void doIt2()

This was of course in the class Form7.cs which was actually documented elsewhere explaining that the original dev had made a few different versions and this was the one that worked best.

Ryan Elkins
A: 

bigSmellyMonkeyButt

Aaron F.
+4  A: 

I worked on some code for a company that had a strict naming convention for C source and header files.

All file names had to be 8 characters long (plus a .c or .h extension), where the first letter was a code indicating the project, the next three indicated the module, and the last four indicated a sub-module. For public module interface header files the sub-module designation was "head".

This meant that at one point I ended up creating the file shithead.h ... and was not allowed to change the name of it even if I had wanted to!

Vicky
+2  A: 

Not really a valid answer--but when I work in VB.NET I'll occasionally start writing AssHandler in place of AddHandler

STW
+2  A: 

I created a custom exception named the ObamaException that gets thrown when some stuff fails. It's only inappropriate cause I was working for a govt. agency at the time. hehe

Ed B
+10  A: 

I once created a table to keep track of the usage of the SA user on a DB. Of course I named it SAUsageLog

I didn't realize my mistake, until a colleague asked what's the deal with the Sausage Log table.

Whoops

Conrad Frix
+4  A: 

When it gets close to the end of the day, I get quite liberal with my naming conventions. Basically I name variables a random persons name or whatever pops in to my head. I do this to focus on the logic of the method after which I go back and decide what good variable names would be.

One day, I had forgotten to go back and fix the names. I submitted the code to SVN. The next day my co-worker, let's call him Frank, yells my way, "What the f*#$?"

He had come across a little snippet of code I had written:

Frank.isAPrettyPrincess();

revil
+1  A: 

I just worked on a codebase that had the function

int fuckBitmaps() { ...

Browsing the code, about 100 lines looked like this:

if(a < b)
    a = a;

Hoping for some answers, I took a look at the commit log. The commit message was:

Eric is smelly.

BlueRaja - Danny Pflughoeft
A: 

We still laugh about some old VB code we inherited nigh on 10 years ago:

If Not bNotBad = True Then
    ....
End If
Mark
A: 

Not actually programming identifiers, but I'm not a native english speaker, and every time I want to say CamelCase, I first think of "Camel toe", so I have to be very careful not saying it out loud.

Petruza