23

Naming things well is arguably Job 1 for professional programmers. Yet we have all suffered from some bad naming choices from time to time. So just to vent a little, what are some doozies that you may have run across?


Just to get things started:

One of our original developers wasn't sure what to call a secondary key - on what turned out to be a primary table for this app - so he called it: DL2WhateverTheHellThatIs.

Unfortunately this system generates entity mappings from the XML, and attributes defined there result in classes, methods, and constants that are referenced through-out the app. To this day it is very hard to find a source file that does not reference this, er, thing! A few actual examples:

DL2WhateverTheHellThatIsBean cos = (DL2WhateverTheHellThatIsBean)itr.next();

String code = getDL2WhateverTheHellThatIs().getCode();

From from = new From("DL2WhateverTheHellThatIs");

String filter = "_dL2WhateverTheHellThatIs._code";

(Very difficult to refactor)

76 accepted

At my first programming job, we had a system which would scan images of checks in large batches, use a MICR reader to pull the account and routing number off the check, then match the check to the corresponding account in the database. As you can imagine, some checks are unreadable and can't be paired up with an account. We referred to images without an account as orphans, and our system required all orphans needed to be reconciled by hand and reprocessed. Some methods I remember off the top of my head:

HarvestOrphans - queries the database for orphaned images, pulls images into a grid on the UI.

KillsOrphans - deletes all orphans in the pending deletion queue.

MakeOrphanDirty - method is called when a user modifies an orphan. Sets the "IsDirty" flag on the orphan.

TouchDirtyOrphans - reprocesses orphans modified by the user. First comment in method is // no ! bad touch!

This funny in-joke lasted for 5 years until one of our customers commented on some of our error logs, specifically the OrphanMolestationException recently thrown in the TouchDirtyOrphans method. Its a miracle no one was fired :)

71

isHasDeletePrivilege. One tiny step away from canHasDeletePrivilege, leading me to suspect it may have been written by a cat.

62

A function to return a parentID of some product

<?php

    function whoIsYourDaddy($id)
    {
        return $this->parentID;
    }

?>
36

"SetGetSet" and "GetGetSet". They were used to manipulate mbGetSet flag, which meant some kind of readiness. Well, it's not that bad. But then I saw something like this:

Obj1->SetGetSet(Obj2->GetGetSet())

Looks like a piece of Morse code.

34
void crawl_into_hole_and_die()
{
    while(1); // let the watchdog get us.
}
28

I have a coworker that routinely uses sentences for method names. For example:

LetsProceedWithHandlingTheErrorFromThatOneMethod()

(oh yeah, he begins lots of method names with "Lets")

27

From the Windows 3.x kernel:

void FAR Bunny_351(void);
Long FAR PASCAL BozosLiveHere(HWND, WORD, WORD, DWORD);
WORD FAR PASCAL PrestoChangoSelector(WORD, WORD);

Bunny_351 is a an internal function called when windows shuts down. It's name was to honor a stuffed bunny that had an unfortunate accident with a paper shredder.

BozosLiveHere, a mysterious function that returns the string "USER: Invalid function called. System state potentially trashed,".

PrestoChangoSelector generates a code selector without validating the parameters so it is quicker than ChangeSelector.

Source: Undocumented Windows

21

All variable names that "saves" you 2 or 3 keystrokes.

Like bta instead of beta, prmtr instead of parameter etc.

With intellisense you usually only need the first 3 letters anyway so why not use long descriptive names?

Who came up with this crap from the beginning btw? Was it the low-resolution displays that forced you to do this to get all code on one line or maybe language limitations?

19

Some years ago, I came upon some code like this: (translated in C# from the rather scary scripting language that it was originally in) (Yes, one program, two great dumb variable name stories).

char cArnold = '|';
foreach(char c in GetSomeString())
{
     ...
     if (c == cArnold)
       break;
}

So, why is the end-of-data indicator called "Arnold"? --- Because he's the Terminator!

18

I don't remember the actual collection name, but assMaster was named by my mentor on my last project (and he is a guy who doesn't swear).

foreach(var assMaster in assembly.LinkedAssemblies)
{
   ProcessTypes(assMaster)
}
17
JesusBuysCookies()

Private method in an in-house cookie handling library.

17

One of these days I'm going to find Kerninghan or Ritchie and make them answer to this

//this function takes a character and converts it to an integer
public int atoi(char a){}

atoi? really?

16

Anything prefixed with "My". We once hired a junior programmer who came up with such doozies as "MyClass", "MyInterface", and "MyMethod1". It was clear he was copying/pasting from a general tutorial (we later found it online), but couldn't be troubled to modify the sample.

15

Some PHP code: A function which returns a reference. You can't just return null; because that's not a reference to anything. The workaround:

function &getUser() {
    if (/* there's some sort of error... */) {
        $aStupidFuckingVariableIHaveToMakeBecausePHPWontLetMeJustReturnNullBecauseThatWouldMakeTooMuchSenseAndWouldBeWayTooEasy = null;
        return $aStupidFuckingVariableIHaveToMakeBecausePHPWontLetMeJustReturnNullBecauseThatWouldMakeTooMuchSenseAndWouldBeWayTooEasy;
    }
}
12

While not the "worst" name, this one came to mind.

We have a class used to iterate objects called LOOPER. Here's a code fragment:

LOOPER theSuperDooperLooperScooper( drawing );

theSuperDooperLooperScooper.GetSelected ( GET_ONLY );
11
IsHardwareSoundPlaying_PleaseDontUseThis(). 

Called in at least 50 places in the code base, working perfectly.

11

I came across this method signature which takes full advantage of java case sensitivity.

public void collectOtherProductsData(
    BigDecimal productSeqId, 
    BigDecimal seqId, 
    BigDecimal SeqId)

Now I need to add another sequence id. Any suggestions?

10

We used to work with a guy (he was nominally team lead, although that wasn't really the case) who insisted on the whole team sticking rigidly to his own set of coding standards. One of these was the old faithful of "no line of code shall be greater than 80 characters".

Of course, we took that as a challenge and spent a month or so attempting to create meaningful and descriptive method names that broke that rule all on their own. I forget that name of the actual method thaqt first hit the 81 character golden marker, but it was something like

UploadedObjectValidationParseEmailAddressAndFullNameUsingStandard<companyname>RegularExpressions

Childish, I know, but this was in response to the guy who once rejected some code during code review on the basis that

"The comment on line 96 has too many words that begin with the letter 'P'"

Seriously.

10
doit()
{
    // lots of code
}
9

Some C code to parse a char[7] to get a year for 2-digit sliding window year logic - unfortunately, I did not save it, but it was something like this:

char[7] textbox ;

int one, two, three ;
char[3] temp ;

temp[0] = textbox[0] ;
temp[1] = textbox[1] ;
temp[2] = 0 ;
one = atoi(temp) ;

temp[0] = textbox[2] ;
temp[1] = textbox[3] ;
two = atoi(temp) ;

temp[0] = textbox[4] ;
temp[1] = textbox[5] ;
three = atoi(temp) ;

// And you might think that's bad, but here comes the greatest line in the history of programming:

if ( three > 70 ) { three = three + 1900 }
else { three = three + 2000 }

// I kid you not

This was written by a couple of Clipper programmers who sold the boss on being able to program in C (I guess because it started with the same letter).

8

I once had to port a C application from unix to windows. The specific nature of the application shall remain unnamed, to protect the guilty. Anyways, the guy who wrote it was a professor, and unaccustomed to writing production-quality code. It also happens that English wasn't his first language (though in the country he comes from, the majority of people speak it quite well). Anyways, in a header file named 'Thing.h', he defines the following:

#define I  Any void_me
#define thou  Any void_thee
#define iam(klas)  klas me = (klas) void_me
#define thouart(klas)  klas thee = (klas) void_thee
#define my  me ->
#define thy  thee ->
#define his  him ->
#define our  my methods ->
#define your  thy methods ->

...which he then used to create monstrosities like the following:

void Thing_setName (I, const char *name) {
iam (Thing);
if (name != my name) {   /* Pointer comparison! So that Thing_setName (me, my name) does not fail. */
    Melder_free (my name);
    my name = Melder_wcsdup (name);
    }
    our nameChanged (me);
}

void Thing_overrideClass (I, void *klas) {
iam (Thing);
my methods = (Thing_Table)klas;
if (! ((Thing_Table) klas) -> destroy)
    ((Thing_Table) klas) -> _initialize (klas);
}

I'm so glad he at least put that comment in there; that really clarifies what the hell the code actually is supposed to do. Anyways, the entire project (~60,000 LOC) was written in a similar style -- marco hell, weird names, olde English jargon, etc. Fortunately we were able to throw it out, as we found an OSS library that did the same task, only cleaner and faster.

8

not the worst class name ever, but very very funny when i first saw it in a previous role.

CHandJob

I was lmfao when i saw this. Apparently it was related to the notion of a worker in a factory doing something by hand instead of automated by machine(ie placing components onto a PCB).

7

There was a class called "HelperFunc" in one of the projects I have worked on. That class contained only static "helper" methods which had nothing in common - just a place to throw in random code.

7

I used to work with Powerbuilder and people keep naming variables var1, var2, var3, var4 ... etc. We usually had up to var20. It was hell (I resigned :) )

7

Maybe not 'worst' as it was actually quite descriptive, but a game project had a method:

void removeUnderwear()
6

Single letter variable names.

float p, x, y;

because

 x = sqrt(p * p + y * y);

is much clearer than:

 hypotenuse = sqrt(edge1 * edge1 + edge2 * edge2);
6

In our World Series Baseball code for the Sega Genesis, we had a variable put in by an irate programmer whose name I can't quite type in here, but I think you'll get the idea:

int StupidFxxkingFlagThatSegaMakesUsFxxkingHave

5

Profanity... I won't type the example.

4

Back in the COM days, when MS introduced the smart pointer concept, we had fun with our variable names. We used hungarian notation, and therfore would prefix the variable name with "sp" when using a smart pointer. We also used to truncate the name where possible to save column space. So, a generic IUnknown interface pointer would become "Unk".

You can see where this is going. Juvenile variable names that obey conventions for the win!

4
  • $stmt (PHP / SQL statement member)
  • coi (I did once name a local variable coi - client object invoice - and in Romanian language that would mean "ball" - as in the singular of testicles). I got called in the executive's office for this at that time.
4

An ex-coworker of mine decided that he didn't like the usual way of appending strings in PHP, so created his two functions: StringAppend and dneppAGnirts. Both functions took two arguments, and returned a concatenation, except that the latter would concatenate the two parameters in reverse order.

3

Anything that uses i, I, l, 1, o, O, or 0.

3

Some years ago, I came upon some code like this: (translated in C# from the rather scary scripting language that it was originally in)

foreach(DocumentType shakes in GetDocumentTypes())
{
    ProcessDocumentType(shakes);
}

So, why was the variable holding DocumentType objects calls "shakes". After a few months pondering this, I finally hit me. It was because we calls Document Types, "DTs" which is also the common name for the "Delirium tremens" which is also knows as "The shakes"

3

Function name:

GiveItAWhirl();

followed closely in the code by

GiveItAWhirl2();

These functions just pieced together unrelated data manipulation and UI code.

3

I wrote an article awhile back about what developers can learn from Forrest Gump, specifically I talked about how things get named a lot. One example I quoted was one from Phil Haack:

Request.TakePostedValuesAndSetPropertiesOfTheObjectWithTheSameNameToThePostedValueUsingReflection(product);

While this wasn't in production in the ASP.Net MVC framework it still is pretty funny. Phil came up with it because people were complaining at the time about the name DeserializeTo().

The complete article is here for anyone that cares.

3

From the perverse and happily defunct world of Authorware where spaces in variable names was legal:

booBoolMoveOnIsOn True

Laughably, it was a constant, defined as 1

3
public void la_applete_est_démarrage_ici() {

}

from a coworker which was french and always used method names with french special characters like ç, é, à, etc.

He also invented this boolean ;)

String OuiOuNon = "Non";
if (OuiOuNon == "Non") {

}
2

Using our graph-library, with JavaScript support for dynamic manipulation. No documentation provided:

doThatGraphThing( ... );

I laughed a bit, then went to have a talk with the developer, as this was release-code.

2

supercalifragilisticexpialidocious -- needless to say, this occurred before we had code reviews.

2

I made a Time Clock program for my office. Every time a user clocks in/out the method called is PunchUser().

2

In the old FORTRAN days, we were linking to a vendor library who had no sense of a naming convention, and used simple variables like x any y in the global namespace. Linking to their library was always filled with collisions. We called them and asked them to use a reasonable naming convention or prefix, and their answer was "we don't ever use anything starting with zz, so you guys can just use zz as the first 2 letters!".

As a result all our variables had to start with zz...

Talk about name space pollution.

We eventually dumped that vendor.

2

I also once worked on a project which defined a C++ enum of values returned from a DB search call and included the value "DB_NOTAGOATATALL". I think it was originally DB_NOTAGOATALL for "Not a 'go' at all", i.e. the search failed utterly, however someone decided that "Not a goat all" was bad English and inserted the missing "at", and it just stuck.

2

I once worked on a code base that had the most generic method call I think I've ever seen.

public void execute(Object data);

Unsurprisingly, I can't remember what it was supposed to do.

1

I've been working on an old legacy VB6 program and the butt of most jokes is the function called LoadShmulaka

Shmulaka is not a word that I can find in any dictionary and basically it has become a very bad word in our office. It is a word that means nothing containing code that nobody knows what it does.

1

I was once told a story by a lecturer about a student project. The student decided that their code could also double up some kind of a religious story. With variables like Buddha and Enlightened statements became readable as...

if (Buddha == Enlightened) { SetPathsWalked(&paths); }

The lecturer had no idea what was going on in the code.

1

One guy was pretty angry, so he named all his variable by the names of his family members. After he left, someone had to deal with lots of "string alex", "int john", "DataTable scott", etc..

1

kill - send signal to a process

Synopsis:

int kill(pid_t pid, int sig);

Do you want kill something or do you want send signal?

In my old MSX BASIC you could delete files with KILL filename.

1

A few years ago I had finnish a program started by an intern. He had created a lot of methods like

void Bla(); 
void Blo(short Bla); 
void Bli(int Bla, double Blo);

These methods were used like this throughout the entire project. A complete mess... Horrible...

1

I had to fix bugs in an application that had to delete itself after execution.

The function that performed the (indirect) deletion was called:

void Harakiri();
1
private void rape(TimFlop victim) {
    if (Math.random() < 0.7) {
        flop.getGameObject().AddFlop(new TimFlop(flop, victim));
    }
}
1

Anything mis-spelled which has spread its way through the code thanks to the miracle of intellisense/identifier completion, especially once it surfaces in a public API, which means you then can't correct it without screwing with some customer's software.

1

This one was in C# code. Don't ask me what it was supposed to do.

static Func<T, Func<T>> HeavyMetalIsFun<T>(Func<T> fun);
1

I can't believe no one has mentioned HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor yet. (At least it works as a bit of humor as well.)

1

This was made in vb6, i think the code speaks for himself. I called this: "Temporal Coding"

                    Do While Not rstmp.EOF
                        tmp1 = 0:  tmp2 = 0: tmp3 = 0: tmp4 = 0: tmp5 = 0:  tmp6 = 0
                        Call barraProgr(IIf(rstmp.PercentPosition > ProgressBar1.Min, rstmp.PercentPosition, ProgressBar1.Min))
                        ttLinCod = rstmp.Fields("LINCODIGO")
                        tmpAdd = Trim(rstmp.Fields("LINDESCRIPCION")) + " (Cod:" + Trim(Str(ttLinCod)) + ")" + Chr(9)

                        sql = "SELECT Sum(CUOTA.CUOUNIDADES) AS SumaDeCUOUNIDADES, Sum(CUOTA.CUOMONTO) AS SumaDeCUOMONTO"
                        sql = sql + " FROM CUOTA INNER JOIN PRODUCTO ON CUOTA.PROCODIGO = PRODUCTO.PROCODIGO"
                        sql = sql + " WHERE CUOTA.VENCODIGO=" & iddUsuario
                        sql = sql + " AND PRODUCTO.LINCODIGO=" & ttLinCod
                        sql = sql + " AND CUOTA.CUOPERIODO=" & Format(fchDesdeHasta(0), "yyyymm")
                        Set rsCuota = dbMain.OpenRecordset(sql, dbOpenSnapshot)
                        If rsCuota.EOF Or rsCuota.BOF Then
                        Else
                            If Not IsNull(rsCuota.Fields("SumaDeCUOUNIDADES")) Then
                                tmp1 = rsCuota.Fields("SumaDeCUOUNIDADES") '2
                                tmp2 = rsCuota.Fields("SumaDeCUOMONTO") '3
                                mTotalesMSF(0) = mTotalesMSF(0) + tmp1
                                mTotalesMSF(1) = mTotalesMSF(1) + tmp2
                            End If
                        End If
                        tmpAdd = tmpAdd + Format(tmp1, "###,##0") + Chr(9)
                        tmpAdd = tmpAdd + Format(tmp2, "###,##0") + Chr(9)

                        sql = "SELECT Sum(HISTORIC.HISCANTORDENADA) AS SumaDeHISCANTORDENADA, Sum(HISTORIC.HISMONTO) AS SumaDeHISMONTO"
                        sql = sql + " FROM ((VENCLI INNER JOIN HISTORIC ON VENCLI.CLICODIGO = HISTORIC.CLICODIGO) INNER JOIN VENLIN ON VENCLI.VENCODIGO = VENLIN.VENCODIGO) INNER JOIN PRODUCTO ON (PRODUCTO.LINCODIGO = VENLIN.LINCODIGO) AND (HISTORIC.PROCODIGO = PRODUCTO.PROCODIGO)"
                        sql = sql + " WHERE VENCLI.VENCODIGO=" & iddUsuario
                        sql = sql + " AND VENLIN.LINCODIGO=" & ttLinCod
                        sql = sql + " AND HISTORIC.HISPERIODOFACT=" & Format(fchDesdeHasta(0), "yyyymm")
                        Set rsHist = dbMain.OpenRecordset(sql, dbOpenSnapshot)
                        If rsHist.EOF Or rsHist.BOF Then
                        Else
                            If Not IsNull(rsHist.Fields("SumaDeHISCANTORDENADA")) Then
                                tmp3 = rsHist.Fields("SumaDeHISCANTORDENADA") '4
                                tmp4 = rsHist.Fields("SumaDeHISMONTO") '5
                                mTotalesMSF(2) = mTotalesMSF(2) + tmp3
                                mTotalesMSF(3) = mTotalesMSF(3) + tmp4
                            End If
                        End If
                        tmpAdd = tmpAdd + Format(tmp3, "###,##0") + Chr(9)
                        tmpAdd = tmpAdd + Format(tmp4, "###,##0") + Chr(9)

                        If Month(CDate(fchDesdeHasta(0))) <> Month(Now) Then GoTo noCalcPed

                        sql = "SELECT Sum(ITEM.ITECANTAENTREGAR) AS SumaDeITECANTAENTREGAR, Sum([ITEM]![ITECANTAENTREGAR]*[ITEM]![ITEPRECIOUNIT]) AS PrecioTotal"
                        sql = sql + " FROM (VENLIN INNER JOIN (((ITEM INNER JOIN PEDIDO ON ITEM.PEDCODIGO = PEDIDO.PEDCODIGO) INNER JOIN ESTADO ON ITEM.ESTCODIGO = ESTADO.ESTCODIGO) INNER JOIN VENCLI ON PEDIDO.CLICODIGO = VENCLI.CLICODIGO) ON VENLIN.VENCODIGO = VENCLI.VENCODIGO) INNER JOIN PRODUCTO ON (PRODUCTO.LINCODIGO = VENLIN.LINCODIGO) AND (ITEM.PROCODIGO = PRODUCTO.PROCODIGO)"
                        sql = sql + " WHERE ESTADO.ESTACTIVO=1 AND VENCLI.VENCODIGO=" & iddUsuario
                        sql = sql + " AND VENLIN.LINCODIGO=" & ttLinCod
                        Set rsPed = dbMain.OpenRecordset(sql, dbOpenSnapshot)
                        If rsPed.EOF Or rsPed.BOF Then
                        Else
                            If Not IsNull(rsPed.Fields("SumaDeITECANTAENTREGAR")) Then
                                tmp5 = rsPed.Fields("SumaDeITECANTAENTREGAR") '4
                                tmp6 = rsPed.Fields("PrecioTotal") '5
                                mTotalesMSF(4) = mTotalesMSF(4) + tmp5
                                mTotalesMSF(5) = mTotalesMSF(5) + tmp6
                            End If
                        End If
noCalcPed:
                        tmpAdd = tmpAdd + Format(tmp5, "###,##0") + Chr(9)
                        tmpAdd = tmpAdd + Format(tmp6, "###,##0") + Chr(9)
                        tmpAdd = tmpAdd + Format(tmp3 + tmp5, "###,##0") + Chr(9)
                        tmpAdd = tmpAdd + Format(tmp4 + tmp6, "###,##0") + Chr(9)
                        mTotalesMSF(6) = mTotalesMSF(6) + tmp6 + tmp4
                        If tmp1 = 0 Then
                            tmpCero = 100
                        Else
                            If tmp3 + tmp5 = 0 Then
                                tmpCero = 0
                            Else
                                tmpCero = ((tmp3 + tmp5) / tmp1) * 100
                            End If
                        End If
                        tmpAdd = tmpAdd + Format(tmp3 + tmp5 - tmp1, "#,##0") + Chr(9)
                        tmpAdd = tmpAdd + Format(tmpCero, "#,##0") + "%" + Chr(9)
                        If tmp2 = 0 Then
                            tmpCero = 100
                        Else
                            If tmp4 + tmp6 = 0 Then
                                tmpCero = 0
                            Else
                                tmpCero = ((tmp4 + tmp6) / tmp2) * 100
                            End If
                        End If
                        tmpAdd = tmpAdd + Format(tmp4 + tmp6 - tmp2, "#,##0") + Chr(9)
                        tmpAdd = tmpAdd + Format(tmpCero, "#,##0") + "%"
                        mTotalesMSF(7) = mTotalesMSF(7) + tmp4 + tmp6 - tmp2
                        If tmp1 + tmp2 + tmp3 + tmp4 + tmp5 + tmp6 <> 0 Then msfConsulta.AddItem tmpAdd
                        rstmp.MoveNext
                    Loop
1

I once wrote some machine path optimization code in FORTRAN, where the underlying data structure was a huge array of points (punch hits). In order to optimize the points, I needed to track the start and end of a given range of hits. I did so with the following variables:

ishit
iehit

For the year or so that I worked in and around that code, I always read the variables as "i start hit" and "i end hit". It wasn't until much later, when the code was less familiar to me, that I saw "ishit" for what it really was... ;^)

1

I've read through some of the other answers but none of them seemed to compare to what I've had to work with. Ever wonder to youself if there's anything worse than just naming your variables data1, data2, data3, etc? Try repeating the last letter of your previous variable!

Warning: I just pulled this straight out of the source code to a very critical internal VB6 app I've been tasked with debugging/maintaining. This naming convention is probably proprietary!

Dim tDif As String ' difference in time tBS - tIVM
Dim tDiff As String ' result of tA1Scr - t1RPB
Dim tDifff As String ' result of SubTimes(tA1Scr, tCV1)
Dim tDiffff As String 'result of SubTimes(tA2Scr, tCV3)

I guess it wouldn't be the worst I'd ever seen except that it lied in the middle of the following code block (comments censored only where noted):

  Function Results16()
    Dim ibs As Integer
    Dim ihs As Integer
    Dim tCV2 As String 'time of censored movement
    Dim tCV4 As String 'time of censored movement
    Dim tCV1 As String 'time of censored movement
    Dim tCV3 As String 'time of censored movement
    Dim tIVM As String ' time of censored movement
    Dim isec As mSec ' object to handle time
    Dim rng1RPB As Range ' value/row of censored open
    Dim rng2RPB As Range ' value/row of censored open
    Dim ro1 As Integer ' row
    Dim ro2 As Integer ' row
    Dim t1RPB As String 'time of censored
    Dim t2RPB As String 'time of censored
    Dim tBS As String 'time of combined censored signal
    Dim i As Integer ' wrtie tool for row count
    Dim rngA1Scr As Range ' half scr value/row
    Dim rngA2Scr As Range ' other half scr value/rowf
    Dim tA1Scr As String ' time of half scr A1
    Dim tA2Scr As String ' time of half scr A2
    Dim ros As Integer ' row for scr
    Dim tDif As String ' difference in time tBS - tIVM
    Dim tDiff As String ' result of tA1Scr - t1RPB
    Dim tDifff As String ' result of SubTimes(tA1Scr, tCV1)
    Dim tDiffff As String 'result of SubTimes(tA2Scr, tCV3)
    Dim rng1RPBFlag As Boolean
    Dim rng2RPBFlag As Boolean
    Dim stra As String 'used for printout
    Dim strb As String 'used for printout
    Dim strc As String 'used for printout
    Dim strd As String 'used for printout
    Dim arr(1 To 2)  As String
    Dim r As Integer ' loop through array

    'everything that the results have in common is done in Analyze data
    Call AnalyzeData
    i = 8 

etc etc etc... take note of the fact that Function Results16() indicates that there are AT LEAST 15 other similar functions. Further, please note that neither Results16 nor AnalyzeData take any parameters or have any possible return values--despite being declared as Functions.

1

I once encountered a set of methods that looked like this:

public static void IncrementByOne(ref int integer)
{
    integer++;
}

public static void IncrementByTwo(ref int integer)
{
    integer++;
    integer++;
}

public static void IncrementByNone(ref int integer)
{
}

I guess they served to see if the ++ operator was really working.

1

Code for the main app in my current company has local variables with names like "tmp1", "tmp2" and so on. The name itself is not so bad, but these go up to "tmp37", all in the same 5000 line method. And there is one method in which 23 (!) of these tmp's are passed in as parameters. I suppose I should be impressed that the guy who wrote this could actually keep it all in his head - except maybe he couldn't. "If it was hard to write it should be hard to read. That's why they call it 'code'."

0

Anything that doesn't describe the variable's content.

0

Toto

I maintained a project created by French developers and many local variables were named "toto". There were also some "koko", i think it's a derivative from "toto". I still have no idea what it means :)

0

PHP - in the middle of a controller file, subclassing some of the models:

class X extends Office {
    /* <snip 250 lines of function overloads > */
}

class y extends Employee {
    /* <snip another 250 lines> */
}

$instance = new y();

Absolutely no comments as to why x & y are sub-classing the models (or why it was necessary to do it in the middle of a controler given the pains we went to put in place a framework). The best thing is only one of the two classes are actually used - freelancers, gawd bless 'em …

0

Worked with a guy in FORTRAN days who named all his variables: AA1, AA2 etc. He didn't beliwve in continuation lines so he wrote:

AA1 = expression

then most often but not always on the next line:

AA1 = AA1 + expression

In C, functions named f(), c(), cc().

One I really liked was a flag named: AtLeastOneAntennaPulseInTheLastTenSeconds.

Regards, Bill Drissel

0

I think that the worst examples (other than the obviously funny ones) are the non-english ones. You should not defines variables or whatever in a language that few can recognize. You, at least, lose the semantic power of variable naming.

0

I was maintaining a VB6 app years ago, and came across a situation where I needed to create a single text file by combining two existing text files.

Lucky for me, someone had already written this code. But I had to choose from one of the following methods (which after investigation produced the same result with subtle implementation differences):

  • CombineFiles
  • ConcatFiles
  • JoinFiles
0

Working on a code base originally written in Sweden, I kept running into the same identifier being used over and over for temporary variables. Turns out it was a Swedish cuss word.

0

In a VB4 project I was brought in to refactor, I found a horrible mess of spaghetti code written by a group from the long since absorbed firm of Coopers & Lybrand, where a recursive loop to traverse a tree spanned three procedures and had two control variables DontDoIt and DontDoItAgain!

In another VB4 project I was asked to review, the programmer was a mainframe developer by training and perhaps used to COBOL or Fortran. He wrote a program to perform EDI mapping. All of his variables had names like XY89123, AB891023, etc, and he also left every single control created in the IDE with the default name, so every form was named Form1, Form15, Command1, Command29, etc!!!

0

It is jarring to have variables with spelling or grammatical errors. e.g.

Object corbaProxie = service.getProxie();

List recordsFindedWithPrivlidge = new ArrayList();

I often find myself wondering if English was their first language or if they are just poor spellers. I am usually more tolerant of people for whom English is a 2nd language, but in either case, thank heaven for Alt-Sft-R in Eclipse!

0

I've seen classes named after their author like JohnDoesModule and JaneBanesClass. Enough said.

0

Many years back I wrote an April Fool program using ZXSpectrum Basic as a prank on a fellow pupil which had 'TheInfamousMargretDevanzoSubroutine' in it (Ok, so only two other people in the world will get this joke). Needless to say, it has turned up in a few projects since.

Skizz

0

For me it was a Fortran Logical called LNOGRAF (7 character limit). It was used to determine if a graphics terminal was available. The software it was used in only checked if the graphics terminal was available, so the source code was full of

IF .NOT. LNOGRAF

What was worse is that at the time that I became involved a lot of the code was also in PL/I and that same logical was called LNOGRAF for consistencies sake. I worked on it for 4 years and I'm not sure if we ever got rid of all the LNOGRAF's.

The application was 3D mission planning software for B-52's and Cruise Missiles. It had the distinction of being name GASCAP (mainly because of the 1979 gas crisis).

GASCAP stands for Graphics Application Software for Cruise missile and Aircraft Planning.

0

Maybe not the worst, but one of the funnier ones were from a form for defining Table Type Assignment properties (allow table combining, allow smoking, etc)

TableTypeAssCombine

TableTypeAssSmoking

0

I was contracted a long time ago to port and add features to a reasonably complicated legacy application to a new platform. They didn't let me fix any of the obvious existing flaws in functionality.

Another programmer took over parts of the project for a while. And then a bit later I came back to the code he had changed. He'd introduced variables whose names were variations on STUPIDMARK and MARKSANIDIOT.

sigh. Thanks, man. Look, I do the best I can with the restraints I got.

0

SQL Variable name

Declare @InfiniteLoopCatcher int

Then it was use like

If InfiniteLoopCatcher = 10000 return 0

0

I remember encountering a variable called 'iMinSecureCode' ostensibly for storing an integer holding the mininum security code. But when I pronounced the variable name out loud, somebody asked me: why are you insecure?

0

getIsLocked() or somesuch; it jarred with me in a horrible fashion. Odd names, pop culture references and even long winded drivel I can deal with, but for some reason, this one little method name caused me to die a tiny bit inside.

The rest of the code in question was somewhat...questionable.

0
static int i;  /* file scope */

Someone added a harmless looking for (i = 0; ... ) deep inside a function, assuming that a function this big probably had a local variable called i. It didn't. The compiler didn't complain obviously and the unrelated piece of code that depended on the static variable broke as a result.

0
bool etalon;

Near as I could figure from deciphering the code, it means "default" in some other language.

0

obja,objc,objd,objx,objr,objp... many ex-VB6 programmers in my country like to prefix every object they made with obj. Perhaps that made sense in VB6 but it only reduces readibility in VB.Net.
The problem is that these programmers often are the ones that teach, so the habit is passed to the new generations.

0

On a recent Ruby project, someone had added a method to all numeric types to fromat them as currency. You called it like this:

total.to_buxx

Not the worst thing I ever saw, but it gave me a chuckle.

0

Hmmm...

Public Shared Sub RoboMouse()
    Dim MyRobot As Point
    ' ... '
End Sub
0

There was this really rough migration project I worked on long ago. The specs kept shifting, and the end client hadn't asked for what they wanted or needed, so it was slow going with a lot of rewriting. At one point they brought in this other guy to do further changes to some code I'd already done a lot of work on.

The new guy wasn't aware of the complex and somewhat misguided history of this code, and as you might expect, some of it made me look less than brilliant. That happens when the code is rough to start with, specs are poor, and they absolutely will not let you refactor.

Anyway, a few months later I returned to some of these rough spots to make even more changes. Only to find variables with names like STUPIDMARK and MARKSANIDIOT.

Yeah, thanks dude. Appreciate your support.

0

The use of foo and bar in examples, everywhere, all the time. Because since those words have explicitly no meaning, almost -anything- would be better names for whatever the variables are there for.

0

One that always makes me laugh is kNullObject in the Maya API. However, it's one of those localized jokes so I don't expect anyone that don't speak Swedish to enjoy it.

0

Full disclosure: Something I did in my first couple programming classes while learning Pascal:

done := False;
repeat
  { do stuff }
  if end_condition_met then done := True;
until done;

This might be useful if there are several ways to get out of the loop, but I did this even when there was only one end condition. Fortunately, I outgrew that after a while.

Alas, in trying to remember enough Pascal to make this look right, I just found an online example doing the same thing. :-(

0

I had to maintain a file littered with:

int link_state;
int lnk_handle;
int lnk_hdl;
int grp_lnk_index;
int grp_link;
int blk_hdl;
int active_link;
int group_handle;
int group_cfg;
control_block_config* ctrl_block;

No rhyme or reason to whether the name would be abbreviated. What a minefield. The first thing I did was global search & replace each name with the spelled-out version. (Not that big a risk given that the code was a disaster to begin with...)

0

I did encoutered :

if (!$this->get("justdoit"))
{
    $this->setError(True);
}

One of my colleague had to refactor this code, lost in a 5000 lines long PHP script without single class but full of nested "if". Needingless to say that after 3 months, he rewrote it entirely and we never knew what was that line for.

0

I honestly encountered complete applications written almost entirely with generic method/variable names...

Variables:

  • MyA
  • MyB
  • Txt122

Functions:

  • DoThis
  • DoFunction
0

f($x), ff($x), ff2($x), fff($x, $x2), ffg($f), fgg($f, $z), ...

And this beauties usually reproduce by copy-paste

0

I once implemented a pool of worker processes where a ProcessPool object managed a number of PoolProcess objects. The names are technically correct, but try explaining the design (even to yourself!)

0

We've this method (Java, made around November 2001, still running today)

 ArrayList _DB2XML(String timeType,ArrayList timeSpans)

It, obviously, takes an ArrayLists of date related strings e.g. weeks on the format "2000 W31", or months, in the form of "2000.10". And returns an ArrayList of all the hours (in the form "2000.10.01.12") of the given time spans.

0
void f1() {
   f2();
}

void f2() {
    f3();
}

etc...

If your function names are as verbose as the ones I mentioned, you've got a serious problem on your hands.

0
System.out.println(p.getPaula());

Brillant

http://thedailywtf.com/Articles/The_Brillant_Paula_Bean.aspx

0

A third party Java API I've been using contains interesting classnames. I actually had to relocate my project to the root folder of my hard drive when I hit the Windows XP 255 character path limit.

public class ISearchCommodityQuote1HttpAndRKDTokenISearchCommodityQuote1HttpAndRKDTokenGetCommodityQuote1ClientErrorReferenceFaultMessage

Some of the methods are pretty cool too, such as my favorite getValueOrOrOrAnd(). It returns a value or two of them combined with an "or" or "and" boolean operator.

-1

Mine would have to be:

int cnt

Very easy to say what that was....with a vowel dropped, but I strangely enough I get into the habit of doing that in writing loops like this

for (int cnt = 0; cnt < len; cnt++){ .... }

Incidentally, I am not alone on this, a perl programmer once typed in by mistake on the perl variable in front of a crowd, $c*nt by accident....instead of $count....

Best regards, Tom.

-6
i

I know, we all love using i for loops, but it's pretty much always the worst choice. Be more descriptive!

I hate seeing loops such as:

for ($i = 0; $i < 10; $i++) {
    for ($j = 0; $j < $i; $j++) {
            $k = $j * $i;
    }
}

It isn't readable, and it doesn't help anyone!