• (cs)

    Coding midterms forced this?

    No, no. Nothing could have forced this young person to write such a horrible pile of code.

    My money's on that it was auto-generated by a tool. That, at least, will allow the turing machine in my head to terminate, instead of looping forever.

  • Zonkers (unregistered)
    Coming midterms forced me to write the program as is because this format required the least amount of thinking as well as the least amount of time.

    Wow, no way this is the least amount of thinking and time. The student must have spent way more time on this than was expected.

  • (unregistered)

    Did anyone else wonder if this guy was related to Sarah Connor?

  • Fredric (unregistered)

    So, how much did he give the student?

    captcha: craaazy (yep sure is!)

  • Bavo (unregistered)

    I actually implemented a slot game once without loops or new methods, it just used the repaint method. It took me weeks to develop because everything had to be copies and paste to the insane. I didnt even know about multidimensional arrays.

  • (cs)

    You might think that the student wanted to get a pay-by-the-line job, except for the apology kills that off and replaces it with admitted ignorance... unbelievable! When I was reading this submission, I went temporarily blind while trying to read the untrimmed snippet. -devin

  • Trevor (unregistered)

    Poor guy. Reminds me of the dude who saw my website, and emailed me for Ajax help. While I was trying to show him how to make something work, he told me that he refused to write functions because he didn't want to be 'lazy'.

  • mcbeev (unregistered)

    if(male == female)

    heheheheheheh

  • J Random Hacker (unregistered) in reply to
    :
    Did anyone else wonder if this guy was related to Sarah Connor?

    No, but I was thinking that if John Connor was the student, we would all be doomed.

  • (cs) in reply to Zonkers
    Zonkers:
    Wow, no way this is the least amount of thinking and time. The student must have spent way more time on this than was expected.

    Copy and paste! Doing it statically (without loops) allows you to evaluate each case manually. Since the points on the corners, top edge, bottom edge, left edge, right edge, and middle are all different he could just look at where the point is and act on it. He doesn't have the programmers mindset to dynamically figure out where the point is and what to do with it.

    Just my best guess.

  • steven22 (unregistered)

    reminds me of my first programming attempts in 7th grade using basic

  • p (unregistered) in reply to Trevor

    I knew a guy who planned to write a web browser, but I thought he was getting out of his depth as I thought his programming ability was limited. I asked "Did you find it hard getting your head round RFC2616?" and he said "What's an RFC?".

  • leeg (unregistered)

    I see the problem: the code should consider all possible states: Male, Female and FileNotFound.

  • Duston (unregistered) in reply to mcbeev

    Should be if((male == female) || FILE_NOT_FOUND)

  • Anonymous (unregistered)

    This is why many universities give marks for style as well as correctness. It was not uncommon for this to be as much as a 50/50 split at my university. Typically style marks were used to prop up an otherwise failing assignment, but that wouldn't help here. IMHO this is likely worth 27%...

    25% because it is "half-correct". 1% because the student indented it properly. 1% because they don't try to do too many things on one line, rendering it unreadable.

    Still an outright fail in my book.

  • Toji (unregistered)

    Um... wow. Just wow. Aren't there laws against this type of inhumane treatment of Game-of-Life-Blobs?

  • (cs) in reply to leeg
    leeg:
    I see the problem: the code should consider all possible states: Male, Female and FileNotFound.

    Then of course females have the ability to throw "Access Denied" exceptions randomly.

  • Burninator (unregistered) in reply to J Random Hacker

    No, all you have to do is upload this code to skynet and the problem would be solved.

  • HappyFanaticSalsero (unregistered)

    Pfew! Women and children first... (aren't students young enough to be included in these categories?)

    Unmaintainable code by my book.

  • Nikolas (unregistered)

    never heard of unrolling loops ? it's just optimized !

  • JBQ (unregistered)

    On top of not knowing about loops, he also didn't know about two-dimensional arrays and about symbolic constants.

  • daves561 (unregistered)

    The real WTF is that the author of this site keeps writing "Java" in ALL CAPS.

    It's not an acronym.

  • Grant (unregistered)

    Don't you guys have a policy on posting student code?

  • Baggy McBagster (unregistered)

    Unless 'n' is a class member var, which I refuse to believe can be the case, this won't compile because there's no 'n' defined for if "(spotvalue[n] == 0)"

    I suspect therefore that anonymization may be distorting this wtf a bit?

    Unless n IS a member variable, with the meaning 'square we are currently looking at'... no, no I can't believe that.

  • Berend (unregistered) in reply to Nikolas
    Nikolas:
    never heard of unrolling loops ? it's just optimized !

    Thats not optimizing - thats giving the finger to the compiler... I feel sorry for the program that is supposedto read this... lol

    capt: atari - yes even in those days code was better written

  • Ron (unregistered)

    I used to be a grader for an intro-level C course (although the students had 2 terms of Java under their belts). And I must say, that kind of apology is very, very common. As is blasphemous, unholy code.

    I'd give the coder bonus marks for indenting properly, though. I can find some old code I marked that was fairly fairly simple (tic-tac-toe) that has huge statements involving combinations of ascii numbers (93 instead of 'a') and character representations, such as (to use a short example.. and forgive me if my ascii representations are off, it's 8am): if(c>=93&&c<=119&&(c=='o'||c=='x'))

  • nobody (unregistered)

    When the student flunks out, he'll get a contracting position. But when he "focks up", he'll write it in comments instead of a handwritten note.

    Captcha: stinky. Yes, it is

  • (cs)

    Maybe it's because of my generally insane condition, but this code is IMO not hard to read. What the student did is to treat every corner cell as a special case (0 is top-left, 19 is top-right, 380 is bottom-left, etc.); I guess he did the same with the border cells. It's probably not an inability to use loops, but rather along the lines of not knowing the % operator.

  • dustin (unregistered) in reply to Duston
    Duston:
    Should be if((male == female) || FILE_NOT_FOUND)

    lies

    should be

    if((male == female) || SEX_NOT_FOUND)

  • SomeBum (unregistered)

    He probably got the code for one turn/iteration off someone else/class notes, and copy-pasted that instead of putting it in a loop with appropriate modifications.

  • noname (unregistered)

    Are you so desperate for WTFs that you need to pick on poor students now. I thought the official policy at TDWTF was not to make fun of people trying to learn.

  • fax (unregistered) in reply to nobody
    nobody:
    When the student flunks out, he'll get a contracting position. But when he "focks up", he'll write it in comments instead of a handwritten note.

    Captcha: stinky. Yes, it is

    Or he could print out the comments, put them on a wooden table, make a photograph of it and send it to his boss by fax :)

  • (cs)

    The biggest WTF here is:

    Student:
    ... this format required the least amount of thinking as well as the least amount of time.
  • (cs)

    I love it. What an excellent anti-pattern. "Coding Without Loops". It's so good in fact I shall incorporate the theory into my new programming task. :)

  • G D (unregistered) in reply to nobody
    nobody:
    When the student flunks out, he'll get a contracting position. But when he "focks up", he'll write it in comments instead of a handwritten note.

    If he's at all like the students I graded who wrote this sort of high quality code (in their fourth year @ WTFU), they'll get a job doing webpages for a local government entity. Ever wonder why your local county government webpage is awful? Now you know why.

    Capt: sanitarium. Where I wanted to be after grading Language Theory/Automata homeworks for 6 hours straight on a Saturday.

  • (cs) in reply to G D

    Yeah, picking on students is too easy IMO. Especially in an intro course where the goal is to weed out the students who "just don't get it." I'm sure at least half of the students in those courses turn in atrocities.

  • Shoop (unregistered)
    <badjoke theme="wah wah wah">

    This will all be moot when John Connor is sent back in time to stop the Terminator from becoming the first cyborg governor.

    Although, being a resident cyborg in California probably isn't that bad.

    </badjoke>

    CAPTCHA is xevious. My thoughts exactly.

  • G-Unit (unregistered)

    This gives a new meaning to loop unrolling.

    How long does it really take to learn about loops? Normally that's what, a chapter in a intro to programming book? I imagine that reading a chapter is much quicker than writing the extra 1000 or so lines of code that he had to write.

  • (cs) in reply to shadowman

    I never had a problem like that as a student (well, at least not in programming courses anyway), but I can sort of see when someone who just doesn't get programming constructs beyond if-else might do that...

    Just guessing here, but maybe they tried and just couldn't get it, and then realized that they could handle each individual case (although there are many) easily, and so just brute-forced the whole thing?!!

    I've had students turn in stuff like that to me. I usually let it slide, the first time, IF they agreed to spend time with me so I could show them how to do it properly AND then did a better job rewriting the thing (I'm a softie for giving folks a second chance).

  • (cs) in reply to dustin
    dustin:
    Duston:
    Should be if((male == female) || FILE_NOT_FOUND)

    lies

    should be

    if((male == female) || SEX_NOT_FOUND)

    What the hell is wrong with you people? SEX_NOT_FOUND is almost definitely defined as something non zero, so this will always evaluate to true! If you want to be cute, at least try and be intelligent. I think this is what you meant:

    if ((male == female) || SEX_NOT_FOUND == male || SEX_NOT_FOUND == female) { learnMoreAboutGender(); }

  • (cs) in reply to Ron

    I remember writing a Tic-Tac-Toe game in intro to VB. For the computer's <flinch>A.I.</flinch>, I used a giant Select Case statement. Yep, after 38 pages of copy-cut-paste code, I finaly said, "There has to be a better way."
    I turned in what I had on a floppy disk except the heads on the schools floppy drive were missaligned and the teacher couldn't read the assignment. On top of that, the work station got rebuilt over the weekend and wiped out my original. I was pretty upset at the time but looking back, I think it was kind of a blessing. If that teacher would have saw that monstrosity that I created, he probably would have given me less than a zero.

  • Chris (unregistered) in reply to Anonymous
    Anonymous:
    1% because the student indented it properly.

    No, not if you would follow the Java Coding Standard ;-)

  • (cs) in reply to KattMan
    KattMan:
    Then of course females have the ability to throw "Access Denied" exceptions randomly.

    Haha, that was perfect!

  • (cs) in reply to mkb
    mkb:
    dustin:
    Duston:
    Should be if((male == female) || FILE_NOT_FOUND)

    lies

    should be

    if((male == female) || SEX_NOT_FOUND)

    What the hell is wrong with you people? SEX_NOT_FOUND is almost definitely defined as something non zero, so this will always evaluate to true! If you want to be cute, at least try and be intelligent. I think this is what you meant:

    if ((male == female) || SEX_NOT_FOUND == male || SEX_NOT_FOUND == female) { learnMoreAboutGender(); }

    if (male == female) { return( NO_THANKS_IM_NOT_THAT_HARD_UP_FOR_IT ); }

  • (cs)

    int i, neighbor, male, female, empty, value, num;

    ... ... ...

    if (male >= 1 && male <=2) { if (male == female) { num = rand.nextInt(2); value = num + 1; return value; } else { value = 0; return value; } }

    A chapter in integer math wouldn't hurt this kid either.

  • Yo (unregistered) in reply to

    same thing came into my mind hahaha

  • Yo (unregistered) in reply to mcbeev

    hahahahahahahaha Awesome

  • (cs) in reply to ssprencel
    ssprencel:

    if (male == female) { return( NO_THANKS_IM_NOT_THAT_HARD_UP_FOR_IT ); }

    No, I think it's time to : NoThanksException up = new NoThanksException(); throw(up);

    :D

  • (cs)

    I've graded this program. 12 years ago and in C, but I swear I've graded this program.

    I took the apology in stride because I apologized for the beer stains and smell on the printout. With programs like this, you expect me to grade sober?

  • fanguad (unregistered)

    As a college grader for 4 years, this sort of thing is not that uncommon, much less a WTF.

    The apology was much longer than the average apology, but has all the marks of "class clown" on it - big words, generous statements, and an ability to accept himself as he is.

    I won't dispute that this way took the least amount of thinking, but it definitely didn't save him on time.

    Finally, I think there should be a rule that you can't use student code on TDWTF. OF COURSE a lot of that code is bad. That's like making fun of my lack of ability to run a marathon or something.

Leave a comment on “So Bad It Needs An Apology”

Log In or post as a guest

Replying to comment #:

« Return to Article