• David Cumps (unregistered)

    What is the (supposed) purpose of this? :)

  • Randy (unregistered)

    Ugh.

    I especially love the default part - just in case FOR should increment i beyond its bounds.

  • brodi (unregistered)

    ??? Looks like a Basic programmer turned Java to me...

  • Richard Dudley (unregistered)

    Just goes to show Java people have no class.

    What is "Waight" (case 11)?

  • Paul Shields (unregistered)

    you're missing the final closing brace on this... is there some hidden snippet of code that would give it more meaning?

  • Ralph (unregistered)

    Wow! Just wow!

  • Black (unregistered)

    All i can say is.. WTF!.. ofcourse the wtf is purely related to "WHAT THE FUCK WAS HE SMOKING, WHEN HE CODED THIS"

    I can only guess that the switch (i) was once user specific, or atleast i would hope it to be, since I'dd only write shit like this if i had lost all controll of my bladder and proceeded to urinate vigorousely everywhere..

    things that make you go WTF!

  • Hassan Voyeau (unregistered)

    I agree with Paul, we can only see the start of the loop, and as such I can't say anything besides the spelling of weight (productWaight)...

  • Frijoles (unregistered)

    Since his switch statement is on 'i' from the for loop, wouldn't case 11 always be the last item called, and thus his list always equal to the productWaight? His debug would be full of stuff, too.

    That's provided there's nothing below it.

  • Hassan Voyeau (unregistered)

    That would be true if only there was a } at the end of the code we see...

  • Mike Strom (unregistered)

    Paul just a cut and paste error nothing gives this more meaning.

    Also a small correction on the approved part. We only do the review someone else digests it and approves it. Our report was delivered with over 500 pages of suggested changes. But this was not one of them as stated this part did pass. And the purpose of this seems clearly to inflate the line count.

  • Jake Vinson (unregistered)

    I like surrounding every line in a try/catch block.

    Then I put all of the try/catch blocks in a case statement, where each one is a numbered line in a for loop.

    Then I put a default value at the end that will never ever possibly EVER execute.

    And then I wait for the day that some entry-level programmer has to maintain my code.

  • Ron (unregistered)

    The interesting thing to me is that all the concepts that are alluded to by the variable names for some reason are handled via a List reference.

  • Patrick Sullivan (unregistered)

    gotta love the productWaight array list, i'm guessing it involves some matrix where depending on the wEight of a product you have to wait a certain amount of time before you can get it...

  • Patrick Sullivan (unregistered)

    hence the productWaight

  • Don Newman (unregistered)

    I have to agree with Paul on this one. This could just be iterating through debugging tests. Without knowing what code is between this and the closing } for the loop there is nothing to bash but a typo on the variable.

    It wouldn't be the first time I saw somebody spell a variable wrong that made it into production. Somebody does a typo and checks in their code, another person doesn't correct the other person's code and just follows the typo so they can keep working, the first person can't correct their code without breaking the second person's code.

  • Don Newman (unregistered)

    Oh, and lets not forget to pick on the typo for "catagory". Sometimes code is screwed and sometimes it is just nit picking on something out of context.

  • Thomas Goyne (unregistered)

    Don> "Paul just a cut and paste error nothing gives this more meaning."

    I assume that means that there is nothing between the end of the snippet and the end of the loop.

  • fogelman (unregistered)

    This is such a common post on this board - we should make it into a pattern!
    Then we can both write a book about this pattern and when it is good to use patterns like this.

  • mork (unregistered)

    I think the developer would've been better off removing the 'break's and just putting an i=12; in the default block.

  • That Guy (unregistered)

    Mike, as a QA guy you're not the bitch who has the spec, are you?

  • setthesun (unregistered)

    i=1, while (i){
    logger.debug("WTF, is this Payment logger ?")
    }

  • AIM48 (unregistered)

    Even without knowing what comes after the } the code is still wrong. Why in the world do you need a loop when you know the sequence of operations you are going to be performing.

    Something like this would be much more sane

    SetListToSomething(paymentMethod,"Payment Method Set");
    etc....

  • bh (unregistered)

    What if there is some code missing at the end of this function. It might even make some sense.
    e.g.
    case 1...default

    do_something_for_current_iteration()

    Listed code is probaby better than:
    case 1 code
    do_something_for_current_iteration()
    case 2 code
    do_something_for_current_iteration()

    etc.

  • pd (unregistered)

    The code missing is probably just adding to a counter or something that would make no sense.

  • Mike Strom (unregistered)

    Again there is no missing code other than the } in question.
    Also I should get the Spec but sense I do security code reviews no one but no one cares what I say or request. I produce a document the document is then summarily ignored and I report the same problem the next time I review the code.
    By the way due to tight deadlines these reviews are normally done on code already in production or so close to being released that the review can’t be implemented.

  • Ben Hutchings (unregistered)

    That Guy: How could QA do its job without having the spec (or whatever documentation expresses what the program is supposed to do)?

  • Mike Strom (unregistered)

    I ask the same question all the time.

  • (cs)

    I think it makes sense. He's unit testing the Java 'for' loop. You know, just in case it breaks and nobody notices.

  • Kryptus (unregistered)

    Anyway, a .Net programmer would never have done such a stupid thing.

Leave a comment on “It doesn't just happen in Basic ...”

Log In or post as a guest

Replying to comment #:

« Return to Article