• SomeGuy (unregistered)

    This reminds me of a time when a buddy of mine was turning in code for a project in our Machine Learning class. He was getting frustrated with the code one night and put in a comment along the lines of:

    //Instantiates your Mom

    Our instructor, a man with a good sense of humor wrote a comment on the returned code going something like "Good work on the project, and my mother will be happy to know she has finally been instantiated.

  • (cs) in reply to SomeGuy

    Do people expect this kind of thing to work?

    Unless that perl script had a LOT more random subjects and bodies, I'd get suspicious after a week or two when they started repeating (complete with typos).

    How lazy do you have to be that you can't even write a new email every day?

  • (cs)

    The function names are hilarious!  I especially like WhosYourDaddy(node). Go Pedro!  [:D]

  • Sumit (unregistered) in reply to rogueRPI

    I would still give the guy points for ingenuity.

  • Brian (unregistered) in reply to rogueRPI

    I never actually saw the emails, but I was suspicious when the manager in charge of catching this years ago repeatedly said the developer in question wouldn't make it to the meeting because he was watching the emails go out.

    Yeah right. :P I guess that speaks volumes about the manager, also.

    But did he get away with it? Yes. Well, until now. :)

  • (cs) in reply to Brian

    Anonymous:
    But did he get away with it? Yes. Well, until now. :)

    That takes some pretty big balls.  I mean, if this is pretty important and he's not really watching the 'emails go out' (WTF?), what if something went completely wrong?

  • Steven (unregistered)

    I don't think I would call this person a bad coder. He's a lazy sneak, yes, but the idea is ingenious enough. Also, the other "interesting findings" aren't really WTFs, are they? Just shows that some coders have a sense of humour.

  • (cs) in reply to Steven

    Anonymous:
    I don't think I would call this person a bad coder. He's a lazy sneak, yes, but the idea is ingenious enough. Also, the other "interesting findings" aren't really WTFs, are they? Just shows that some coders have a sense of humour.

    You might want to re-read the intro.  Also, naming your methods and variables jokey names is WTF.  Try staying up late trying to debug code with no comments and useless variable and method names and contextless debugging that includes commentary on completely usesless aspects of the process and you'll understand.

  • (cs) in reply to Steven
    Steven:
    the other "interesting findings" aren't really WTFs, are they? Just shows that some coders have a sense of humour.

    <font face="Courier New">Can you figure out WTF RiceCrispies(Snap(Crackle(Pop()))) is supposed to do?

    I'm not able to see the humour in it when I'm trying to figure WTF is going on, the code is crashing, and the customer needs it fixed *yesterday*.
    </font>
  • (cs)

    I am so using <font face="Courier New">theInfamousI++</font> as my default incrementer from now on!!

  • diaphanein (unregistered) in reply to mxksweeb

    My favorite comment from my school days (from my own code) was:

    // was drunk...will fix later.

    This comment was followed by a string of variable names containing expletives.  Amazingly, despite being drunk, the code worked.  Just had to rename the variables before submission. 

  • Pragma (unregistered) in reply to loneprogrammer
    loneprogrammer:
    Steven:
    the other "interesting findings" aren't really WTFs, are they? Just shows that some coders have a sense of humour.

    <font face="Courier New">Can you figure out WTF RiceCrispies(Snap(Crackle(Pop()))) is supposed to do?

    I'm not able to see the humour in it when I'm trying to figure WTF is going on, the code is crashing, and the customer needs it fixed *yesterday*.
    </font>


    I think the obligatory first step is: "What do your <font face="Courier New">RiceCrispies()</font> say to you?"

    It reminds me of when I was helping out other students in my High-School CS class all those years ago.  One fellow had a pascal program with variable names like 'a', 'x', 'n' and so on.  I suggested that he use "real names" instead of "just letters".  He then showed me his revised code with names like "Shaq", "Jordan", "Pete", "Alex" and so on. :'(
  • (cs) in reply to Pragma

    Anonymous:
    It reminds me of when I was helping out other students in my High-School CS class all those years ago.  One fellow had a pascal program with variable names like 'a', 'x', 'n' and so on.  I suggested that he use "real names" instead of "just letters".  He then showed me his revised code with names like "Shaq", "Jordan", "Pete", "Alex" and so on. :'(

    hehe. As you are walking away, he's probably thinking

    "real names.... real names, WHY should I put REAL names in my code? Well, I guess he knows better."

    This is especially tough for people coming to programming from mathematics. In mathematical equations, if you see "ax + by", a, x, b and y are separate variables. In programming, you're just adding two variables. Oddly names ones, but still, just two.

  • WTFPhenom (unregistered) in reply to mxksweeb

    What language do YOU use that you can use ++ in your identifier name?  I'm a Microsoft guy and I truly don't know the answer to that because MS languages don't allow it.

  • (cs)

    Ok, we need to see the ascii image of Trogdor! A google search didn't find anything useful!

  • (cs) in reply to WTFPhenom

    Anonymous:
    What language do YOU use that you can use ++ in your identifier name?  I'm a Microsoft guy and I truly don't know the answer to that because MS languages don't allow it.
    I think he just meant that the variable was "theInfamousI". He didn't say it that way, but I also can't imagine any language that would support that as a legal variable name.

  • SOS (unregistered) in reply to BradC

    Haha, I love those var/func names [:D] Cool going! Great to brigten up some boring code

  • (cs) in reply to BradC
    BradC:
    "real names.... real names, WHY should I put REAL names in my code? Well, I guess he knows better."

    This is especially tough for people coming to programming from mathematics. In mathematical equations, if you see "ax + by", a, x, b and y are separate variables. In programming, you're just adding two variables. Oddly names ones, but still, just two.

    Reminds me of something I did in College for a class project.  Essentially, just the reverse.

    It was to process some mathematical algorithm, so I kept the simplic variable names of the original.  (One was just "X", and there was a pointer called "ptr").

    To document it, a wrote a short story -- a spoof of Sherlock Holmes --- which explained how it worked.  There was a "Mysterious Mr. X" and a dog named "Ptr".  (If I recall correctly, it was called "The Strange Case of Polly Nomial")

    I probably still have the listing somewhere......

    (Oh, and I got an "A" on it.....)

     

     

  • (cs)

    Awesome, never again do I have to stay late at work looking at pron, pretending I'm working.  Y

  • Andy Lester (unregistered)

    I can't believe I'm correcting WTF code, but what he wants is not

    @titles[rand($#titles)]

    but rather

    $titles[rand @titles]

    In a 10-element array, @titles is 10, but $#titles is 9.  He'll always miss the last option.

  • (cs) in reply to JamesCurran
    JamesCurran:
    Reminds me of something I did in College for a class project.  Essentially, just the reverse.

    It was to process some mathematical algorithm, so I kept the simplic variable names of the original.  (One was just "X", and there was a pointer called "ptr").

    To document it, a wrote a short story -- a spoof of Sherlock Holmes --- which explained how it worked.  There was a "Mysterious Mr. X" and a dog named "Ptr".  (If I recall correctly, it was called "The Strange Case of Polly Nomial")

    I probably still have the listing somewhere......

    (Oh, and I got an "A" on it.....)



    That is *awesome*!! I am writing all documentation in the form of prose from now on!  I'm glad you got an A on it too--shows the instructor valued creativity (a good skill in programming) as well as proficiency.

  • (cs) in reply to loneprogrammer
    loneprogrammer:

    <font face="Courier New">Can you figure out WTF RiceCrispies(Snap(Crackle(Pop()))) is supposed to do?
    </font>


    Not without seeing the code, admittedly, but there is no context here. In the real code there may actually be comments there. As it is, it's funny.
  • Top Cod3R (unregistered)

    One thing I like to do when naming my local variables is to prefix them with the function name, something like this:

    Public Sub MyRiceCrispies( )
       Dim MyRiceCrispies_I As Integer
       Dim MyRiceCrispies_X As String
       ...
    End Sub

    This way you always know what function they came from, and it also helps the compiler optimize your code, making it less likely to confuse them with variables from another function.

    Anyone else have any variable naming tips they'd like to share?

  • (cs) in reply to dubwai
    dubwai:

    Try staying up late trying to debug code with no comments and useless variable and method names and contextless debugging that includes commentary on completely usesless aspects of the process and you'll understand.



    You're describing my very job. (Well, actually, you forgot to add one thing: do this on a live system that allows for maintenance only between 1 and 5am)

    At least there is a reason behind many of the variable/function names mentioned ("<font face="Courier New">WhosYourDaddy</font>", for instance). Try the ones I have to deal with:
    • kurvakeves
    • naakkoridajigeljutott
    • namostfoghivni
    • nasikerultis
  • Gooch (unregistered) in reply to BradC

    Perl will quite happily allow you to declare $theInfamousI as a variable, and then increment it via
    $theInfamousI++

    ex: $theInfamousI=0;
    $theInfamousI++
    print "$theInfamousI\n";   -> will print out "1"..

     I'd have to suspect that's what was really going on with that little gem.

  • Moi (unregistered) in reply to loneprogrammer
    loneprogrammer:

    <font face="Courier New">I'm not able to see the humour in it when I'm trying to figure WTF is going on, the code is crashing, and the customer needs it fixed *yesterday*.
    </font>


    You don't know the context. Way to get yer panties in a bunch. A little humour in a small scope is hardly a maintenance issue.
  • fool (unregistered) in reply to cm5400

    my favorite was in some code a friend wrote that had the whitespace-trimmer KillWhitey()

  • (cs) in reply to Kippesoep
    Kippesoep:
    At least there is a reason behind many of the variable/function names mentioned ("<FONT face="Courier New">WhosYourDaddy</FONT>", for instance). Try the ones I have to deal with:
    • kurvakeves
    • naakkoridajigeljutott
    • namostfoghivni
    • nasikerultis

    Is that Swedish or something?

  • (cs) in reply to Top Cod3R

    Anonymous:
    This way you always know what function they came from, and it also helps the compiler optimize your code, making it less likely to confuse them with variables from another function.

    Anyone else have any variable naming tips they'd like to share?

    I can never tell if you are joking with this stuff.  I'm just going to assume you are.

  • itchi (unregistered) in reply to BradC
       w      w__
    _,\ |_(
    \,'\ | |
    './`.__/_`' \ / _
    T' `--.____oVo_/o|
    ,-.-| _____|
    / , \ ,-. `.XXX
    \ -'_,'`. vv v\ `-.__`-.
    ( \ `. vv `. `-'
    \ | `-.v `-.
    <font color="#660066"> |_3 `-. `.</font>
    \ `.
    | \
    | |
    _ / /
    . \`,' ,'
    \'-._|\_|\,' _,'
    `-._________,-'
    | |
    | |
    | |___
    |___

    BURNITATING THE COUNTRYSIDE!
  • (cs) in reply to Top Cod3R
    Anonymous:

    Anyone else have any variable naming tips they'd like to share?

    I use ROT13 on all my variable names.  For security.

  • (cs) in reply to loneprogrammer

    loneprogrammer:

    I use ROT13 on all my variable names.  For security.

    You can always use the characters from the Simpsons.  The nice thing about that is that it's almost impossible to run out of names.

  • (cs) in reply to loneprogrammer

    <FONT face="Courier New">RiceCrispies(Snap(Crackle(Pop() ) ) )</FONT>

    <FONT face="Courier New">Ugh.</FONT>

    <FONT face="Courier New">With a joke name, you know it wont be called from many places so you can just get rid of it.</FONT>

    <FONT face="Courier New">If the names are real-world,use </FONT><FONT face="Courier New">Introduce Explaining Variable.</FONT>

    <FONT face="Courier New"></FONT> 

    <FONT face="Courier New"></FONT> 

    <FONT face="Courier New"></FONT> 

  • e(OR) (unregistered)

    I had a function along these lines once... spankthekids() fired from the controller and rebooted all the child nodes (machine controllers) when they got unruly and nothing but a systemwide restart would do the trick (read: When admin decided we should reboot erverything... just to see if it helps)...

  • (cs) in reply to dubwai

    Hungarian, actually. Problem is, I don't speak Hungarian.

  • Brian (unregistered) in reply to Kippesoep

    Brings a whole new meaning to the phrase 'hungarian notation'

  • StrongBad (unregistered)

    the Trogdor comes in the NIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIGHT!

  • (cs) in reply to Brian

    I have to confess to committing such silliness back in my first semi-professional programming job, a POS (in both senses of the term) for a store I was working for. The sordid details can all be found here (a slightly different version can also be seen here).

    Among the groaners were:

    • the employee database was named Slaves, and the indexes for current and former employees were named Stuck and Canned, while the login list was named Lusers
    • similarly, the Ccustomers database had indexes named Suckers, Marks and Rubes
    • the error handler, Oops, opened a window name S_O_L
    • the flag to indicate whether a customer was in the database was named Cus_P
    • Each file had a comment declaring "This code is cursed"; I had read about this comment appearing in some source code somewhere once, and I found it humorous enough to use it as a kind of 'good luck charm' in my code for a number of years
    Fortunately, I have mostly grown out of this sort of thing, though I do get creative with example code from time to time; for example,  I once posted a pair of sample assembly language programs (I was demonstrating how the Netwide Assembler's %include directive worked to a newcomer) named Phant.asm and Org.asm...
  • em (unregistered) in reply to BradC
    BradC:

    Anonymous:
    What language do YOU use that you can use ++ in your identifier name?  I'm a Microsoft guy and I truly don't know the answer to that because MS languages don't allow it.
    I think he just meant that the variable was "theInfamousI". He didn't say it that way, but I also can't imagine any language that would support that as a legal variable name.

    Welcome to MzScheme version 208, Copyright (c) 2004 PLT Scheme, Inc.
    > (define ++ 5)
    > ++
    5
    > (define + -)
    > (+ 5 1)
    4
    
  • em (unregistered) in reply to em

    Aaargh, your forum software formatted that correctly in the preview, which is definitely a WTF.

    Anyway, the point I was trying to make: Scheme has no reserved identifiers at all, and almost all characters are allowed in identifiers. So, "++" is a valid identifier in Scheme...

  • (cs)

    When I get bored while programming, I also tend to use such names for variables, methods etc. When I was at the university, I had to write a very boring piece of source. Because I read some very famous comic books at that time ("Werner"), I only used the comic sounds as names. It was fully documented, and the program just did what it was supposed to be, but just reading the source without the comments wouldn't give you a single hint, what this program was supposed to do.

  • (cs)

  • CodeToad
  • <FONT face="Courier New">WhosYourDaddy(node)</FONT> *This actually is the function to get the parent node
  • <FONT face="Courier New">Census(node)</FONT> *This it turned out returned all child nodes
  • <FONT face="Courier New">disndat(dis, dat)</FONT> * compares two objects
  • Seperate linked functions called like this <FONT face="Courier New">RiceCrispies(Snap(Crackle(Pop() ) ) ) </FONT>
  • A very nice acsii image of <FONT color=#246398>trogdor</FONT>
  • Incrementers named things like <FONT face="Courier New">theInfamousI++</FONT>
  • If it's not too unclear I find it rather funny to do things a little different. (If you don't exaggerate, that is [:D])  All work and no play makes Jack a dull boy...

  • (cs) in reply to loneprogrammer
    loneprogrammer:
    I use ROT13 on all my variable names.  For security.

    I go one step further -- I use Hungarian Notation.
  • bxc (unregistered) in reply to WTFPhenom
    Anonymous:
    What language do YOU use that you can use ++ in your identifier name?  I'm a Microsoft guy and I truly don't know the answer to that because MS languages don't allow it.
    At least Common Lisp and Scheme allow it.
  • Bruce (from Down Under) (unregistered) in reply to BradC

    {I think he just meant that the variable was "theInfamousI". He didn't say it that way, but I also can't imagine any language that would support that as a legal variable name.}

    <font size="4">Try FORTH or FACTOR to start with, I'm not sure but I think even Smalltalk, and some of the functional languages will allow this.

    This entire discussion has brought tears to my eyes - it has been so funny. Over the last tweny odd years, the industry has come up with some doozies.

    Enjoy your weekend Ladies and Gentlemen.</font>

  • (cs) in reply to JamesCurran
    JamesCurran:
    To document it, a wrote a short story -- a spoof of Sherlock Holmes --- which explained how it worked.  There was a "Mysterious Mr. X" and a dog named "Ptr".  (If I recall correctly, it was called "The Strange Case of Polly Nomial")

    I probably still have the listing somewhere......

    OK, I found the list.  However, 20 year old computer listings (on greenbar paper) don't OCR very well, so post it, I've had to scan it as images and post the GIFs.

    If you want to read it, it's at:

    http://honestillusion.com/photos/the_strange_case_of_polly_nomial

     

     

  • IowaCBR600F4Guy.....can't get my new password at the moment (unregistered) in reply to JamesCurran

    That is an awesome story james

  • Pragma (unregistered) in reply to JamesCurran
    JamesCurran:
    OK, I found the list.  However, 20 year old computer listings (on greenbar paper) don't OCR very well, so post it, I've had to scan it as images and post the GIFs.

    If you want to read it, it's at:

    http://honestillusion.com/photos/the_strange_case_of_polly_nomial


    Not only was that a good read, but it had to be the most creative use of variable names *and* comment space I've ever seen.  The intersection of Sherlock Holmes (er.. "Houses"), aptly-named biblical references, lyrics/poetry, and a double-helix indentation scheme.

    ...although if that was in production (commercial) code, I'd smack you with a trout. 

    10/10 WTF points. (would've been a '9' but the code obviously predates Trogdor)

  • Fromeo (unregistered) in reply to IowaCBR600F4Guy.....can't get my new password at the moment

    The variable names remind me of a program I wrote at one point that involved a leftist heap (http://www.cs.dartmouth.edu/~chepner/cs15/notes/16_heaps.html).  I called the whole structure a commie_heap, and named all the local variables within the implementation after communist leaders, so you'd have functions like:

    commie_heap_merge(struct commie_heap *lenin, struct commie_heap *trotsky)

    ...and so on.

  • Blake Miller (unregistered) in reply to Top Cod3R

    C and C++ would NEVER confuse a local variable with 'another variable from another function'.  It just can't happen.

    If I want to name a local variable the same as something already global, I usually put an l_ in front of the name.  There is no need to put the entire function name in front of a variable like you do if writing in C and C++, and it really contributes nothing to the clarity of the code whatsoever.

    Unless your I or X are used trivially, you would do better to spend your time naming them something other than 'I' and 'X'.

     

Leave a comment on “theInfamousI and The Responsible Guy”

Log In or post as a guest

Replying to comment #:

« Return to Article