• (cs) in reply to konrad
    konrad:
    Interesting, to say the least. Still wish we'd know what this was actually used for.
    Looks like a "Paint by numbers" product to me, only using code. All the outlining has been done for you, by an expert. All you have to do is to grip the big purple crayon and fill it in.

    This one is the "beginner level" one. The "intermediate level" introduces more complicated control statements such as "while" and "come from." The "expert level" version introduces recursion and is, as far as I can make out, Turing-complete.

  • Jens Kleemann (unregistered)

    I would love to see a full featured unit test for this method (including a coverage of >90% ) ... that would be an even greater WTF

  • Carl (unregistered)

    That is truly a thing of beauty. Perhaps we can now use the same grading scale that cyclists use for rating the difficulty of a climb to rate the complexity of code?

  • Steve (unregistered)

    Did that once, this one's 1800+ lines. Best part is the comment, see if you can spot it (hint: look for "end of"). None of this is made up, I did this out of frustration one day after having to work on an entrance servlet for a large site that had had dozens of contractors working on it for years. The "LoginServlet" from which the masterpiece below appeared, had over 2500 lines. { { } { } { { if { } if { { } { } } if { } if { { if { } if { } if { } if { } if { } { if { } } { { } { } } if { } } } else { } { if { } if { } } { } if { } if { { { if { } } { { } { } } { if { } } { { } { } } if { } { } { } { if { } if { } } { { } { } } { if { } } { { } { } } { if { } } { { } { } } if { } if { } if { } { if { } else if { } else if { } else if { } else if { } else if { if { } { if { } } { { } { } } if { } if { } if { } if { } if { } { if { } } { { } { } } if { } else { } } else { { } { } } } { { } { } } if { } else { } } } else { } { if { } if { } } { } if { } if { } if { { if { } { if { } if { } } { { } { } } if { } if { } if { } if { } if { if { } } else if { } if { } if { } if { } if { } { if { } } if { } if { } } } { if { } if { } } { } { } { if { } else { } } if { } if { } if { } } { { } { } } { { } { } { } { } { } { } } } { { if { } if { { } { } } { if { } } { { } { } } if { } if { { if { } { } { } { if { } if { } if { } if { } } { { } { } } if { } { if { } } { } { if { if { { if { } if { } if { } } { } } if { if { } { if { } } { { } { } } { if { } } { { } { } } { if { } } { { } { } } { if { } } { { } { } } { if { } } { { } { } } if { { if { } if { } if { } else { } if { } if { } if { if { } else { } } else if { } } } if { } if { if { } { if { } if { } if { } if { } if { if { } else { if { } if { } if { } } } else if { } } } if { { if { { } { } { } { { } { } } } } } // end of if } } } { } } } if { } { { } } { { if { } if { } if { } if { } if { } if { } if { } if { } if { { } { { } { } } } else { } if { } else { } if { } else { } if { } else { } { if { } else { } if { } else { } if { } if { } if { } if { } if { } if { } if { } if { } if { } if { } } if { } { if { } if { } if { } } if { } if { } if { } } { { } { } } } { if { } } { } { } if { } } { { } { } } { { } { } { } { } { } { } } } { { } { } if { } if { } if { } } { if { } { if { } if { } if { { } { } } if { { } { } } if { { } { } } if { { } { } } { if { } if { } if { } if { } if { } if { } if { } { } { { } { } } if { } if { } if { } if { if { } else { } if { } else { } if { } else { } } else { if { } else { } if { } else { } if { } else { } } if { } else { } if { } else { } if { } if { } if { if { { } { } } } else { if { } { } { } } } { { } { } } } { { } { } } { { } { } { } { } { } { } } if { } } { if { } { if { } if { } if { { if { } if { } if { } if { } { if { } if { } } { { } { } } if { { } { } } { if { { } { } } if { { } { } } if { { } { } } if { { } { } } if { { } { } } if { } if { } if { } if { } } { { } { } } if { } if { } if { } else { { } { } } } { { } { } } } else { { if { } else { { } { } } } { { } { } } } if { } } { { } { } } { { } { } { } { } { } { } } } { { { if { } if { if { } if { } } else { } } { { } { } } { { } { } { } { } } } { { } { } } { { } { } { } { } { } { } } } { { if { } } { if { } { } { } } { } { if { } } } { if { } { { if { } } } { if { } } } { { { if { } } { } } { } { { } { } { } { } } } { { { if { } if { if { { } { } } } else { { } { } } } { { } { } } { { } { } { } { } } { if { if { { } { } } } else { { } { } } } { { } { } } } { { } { } } { { } { } { } { } { } { } } } { { { if { if { { } { } } } else { { } { } } } { { } { } } } { { } { } } { { } { } { } { } { } { } } } { { { if { if { { } { } } } else { { } { } } } { { } { } } } { { } { } } { { } { } { } { } { } { } } } { if { { } { } } { if { } if { } } } { { { { } { { } { } } { if { } if { } else { } if { } else { } if { } if { } if { } if { } if { } if { } } } { { } { } } } { { } { } } { { } { } { } { } } } { { { if { } { if { } if { if { } else { } if { } else { } if { } if { } if { if { { } { } } } else { { } { } } } } } { { } { } } } { { } { } } { { } { } { } { } { } { } } } { { { if { } if { if { { } { } } } else { { } { } } } { { } { } } } { { } { } } { { } { } { } { } { } { } } } { { } { } } { } { } { } { } { { } { } { } } { { if { } if { { if { } } { if { } } } } { { } { } } { } } { } { if { } else { } } { if { } if { } if { } } { if { } { } { { } { } } } }

  • gruckiii (unregistered)

    I bet that try catches java.lang.Exception (my pet peeve) So if anyone un-wittingly uses a unchecked exception in that big mess, the compiler wont warn them, because it's already caught.

  • Larry Sheldon (unregistered)

    Eons ago, in a place far, far away, there was a COBOL application, and therein dwelt a superior being whose Procedure Division consisted of a single nested "IF" ending in precisely one period (there were lots of periods before the Division Header, of course, and a Paragraph Name following it, but following the period at the end of the Paragraph Name, there was one additional period.

    Much of the actual work was done in SNOFLAKE subroutines.

  • Self Aware (unregistered)

    He could have condensed

    } else {
      if {
        ...
      }
    }
    

    to

    } else if {
      ...
    }
    

    and then it would have cleared up all confusion.

  • A. Nony Mouse (unregistered) in reply to German B.
    German B.:
    konrad:
    Interesting, to say the least. Still wish we'd know what this was actually used for.

    Perhaps a property getter.

    That's a cold thing to say. Also likely to be correct.

    At least it doesn't seem to have a 4500 line while loop, or a case statement with 138 options.

  • moz (unregistered) in reply to Andrey Vul
    Andrey Vul:
    zzo38:
    Maybe it is because Java has no goto command and they were trying to make something with goto but they can't, so they are forced to do it like this instead.
    What about creative uses of labeled break/continue statements? Surely, each block can be wrapped in a do { ... } while (false), right?
    I don't know how well that works, but a goto in java is as easy as this:
    for (int line = 0; line >= 0; line -= 1000000)
    {
    if (line <= 10) {System.out.println("Guess what I can do?");}
    if (line <= 20) {System.out.println("I can beep!");}
    if (line <= 30) {System.out.print("\007");}
    if (line <= 40) {line = 20+1000000;}
    if (line <= 50) {System.out.print("I can't get here, though.");}
    }
  • ask_after (unregistered)

    по 5 ифов подряд и не одного кейса... что ж там там за логика такая была...

  • ask_after (unregistered)

    по 5 ифов подряд и не одного кейса... что ж там там за логика такая была...

  • AKoumjian (unregistered)

    Perhaps this code is beautiful because of the ridiculous amount of clauses the programmer had to conceptualize while writing it. Whatever this was, it seems like it would have been better suited for something like Lisp.

  • fishbane (unregistered)

    It is only 9AM, and now my head hurts.

    At a certain point, why bother even using try/catch statements? I guess variety is the spice of... something.

  • (cs)

    I once wrote a downhill skiing game for the ZX Spectrum. It looked a lot like this.

  • George (unregistered)

    If the original author actually understood it (as opposed to poking it occasionally with a long stick to see if it was alive), give him/her 3 points for powers of concentration while composing it. Holy cow.

  • Douglas (unregistered)

    That is quite probably the most appropriate use of the "finally" keyword ever.

  • Vox Neo (unregistered)

    Try tilting your screen 90 degrees counterclockwize and you can see the chart of next years' tour.

    I worked at an office where a guy worked who coded very similarly... They had to enforce the java-team with two programmers from another company to update the application this rider had ridden.

    The hired fellows told my colleague who inherited this project that one should never go deeper using nested logical statements, something I try to remember: Back in the days I made a similar chart in PHP only to realize afterwards that I'd have been better off using some of PHP's "ready made" functions and a bit of AND/OR work...

    This is how one makes onselves' indisposable. Ghehe.

  • Mike Mc (unregistered)

    I like the fact that it ends with "finally"!

  • Golfman (unregistered)

    I wrote a system for a company once and I could see the requirements were for a complex set of state transitions based on many conditions so obviously I implemented the core of the app as a state machine that worked flawlessly for years.

    ... then came a long a much more 'senior and respected' developer (in his mind at least) and he wrote a new system (because newer is better) and he replaced the simple, robust, easy to understand state machine implementation with one class that had a number of methods that looked very similar to your example above - only it ended up being thousands of lines long.

    From that time forth customers started hating the product (because it became buggy as all hell - especially when the requirements changed in subtle ways) and developers hated working on the product. I know of at least 3 employees who left the company because they would rather find another job working anywhere else than working on that code base!

Leave a comment on “Coding Like the Tour de France”

Log In or post as a guest

Replying to comment #:

« Return to Article