PreviousNext…

Bad variable names

Come on, chip in with your discoveries and / or inventions. You know you want to!

Andy Lester: The world’s two worst variable names.

Via Bob Congdon.

OK, I’ll start. One of my favourite bad variable names in Lotusscript is doc. Doesn’t sound so bad? It was a variable reference for a NotesDatabase object.

Of course.

As one would expect, this sort of thing gets covered at WardsWiki too.

Comments

  1. The WardsWiki page is snorting-your-coffee-through-your-nose funny.

    many thanks..Justin Knol#
  2. i wish i could still drink coffee.

    *sigh*

    i have a strong desire to cull through my old code and find bad variable names. i'm sure there are plenty. but i just haven't had a chance, too busy right now. i think it is sort of an art to getting variable names right. there are so many ways to go. one thing is for sure, i'm not very consistent. but i do try… jonvon#
  3. I used to work with a guy who wrote AppleScript code that used variable names for temporary items (instead of using 'temp') that were always of the format - for example flamingGerbil, drunkBadger, hairyElephant and my favourite mensturatingGopher.

    Steve#
  4. The worst I've encountered is not necessarily due to bad coding but language differences. I worked on an application originally developed in Germany. With German variables. I don't speak German, but made good use of a Bable fish http://babelfish.altavista.com.

    I don't remember all the variable names off the top of my head but here are some examples of the sorts of thing I was working with.

    zuerstSuchzeichenkette <-- First Search String
    DbdermenschlichenBetriebsmittel <- HR Db
    SendenSieNamensänderungAnmerkung <- Send name change note
    Etc.

    Not really bad variable names when you know what they are but in a foreign language, Ouch! It was painfull. And to make matters worse 'Declare Explicit' had not been used and my spelling is not great in English.AJP#
  5. hahahaha - menstruating gopher? Steve wins the prize, surely..

    I'll never forget my old A-level computer science classes - I used to sit next to a guy who used two or three letter grunt sounds as his variable names - duf, ug, urg, ar

    His code was very entertaining to troubleshoot as you can imagine.Spikeymikey#
  6. ok, here is one.

    Dim naughtyLength As Integer

    i'm sorry, i just wrote that one today. i'll say some hail mary's later. there really is a good reason for it in the context of the application. if i can come up with a reason to use drunkBadger, i certainly will.

    :-Djonvon#
  7. if i can come up with a reason to use drunkBadger, i certainly will.
    Oh definitely… heh heh. Spikey will agree with me that on a related point, the best Notes agent names we ever had in our organisation were the following from dear chum the Binger:

    “Dave’s Amazing Agent”, and
    “Agent 007”

    Splendid.Ben Poole#
  8. ah, don't forget

    Agent Smith

    ah, here it is:

    http://jonvon.net/jonvon/blog/freedomblog.nsf/stories/an-invisible-pal-and-a-dog-named-spok

    :-Djonvon#
  9. I've realised I'm very lucky in that I've not had to maintain other people's code too often, which is really great because it means that as I get older and wiser I can go in and fix travesties before anyone else has to deal with them :-)

    I tried to slip a standard through relating to the Forall iterator in LS. My colleague made me see the wisdom of simply prefixing a descriptive variable with an 'i', rather than my proposed standard of:

    Forall f**ker in SomeArray…

    I was rather disappointed. I mean, a good forall is never longer than a few lines, many people just use 'foo' anyway, the variable's scope is limited, and you gotta live a little…Colin Pretorius#
  10. mr jonvon,

    I recall finding a few interesting variables in the comments code what you did lob at me…….

    I won't mention what they were in front of these nice people….Justin Knol#
  11. LOL! Also, I have found that Mr. Pretorius’ influence is rubbing off. I just wrote a Forall loop using his lovely iterator name.Ben Poole#
  12. Ah, excellent. My work is done here, then. Spread the gospel… :-)Old Toby Pretorius#
  13. This reminds me of the guy who was reading the translation of a Russian technical document and kept seeing the word "water sheep." He could not figure out what it meant. Finally, he asked someone familiar with the original Russian. Turns out the untranslated term meant "hydraulic ram."Trent#

Comments on this post are now closed.

About

I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.

";