• Vollhorst (unregistered)

    He should be happy it doesn't return a self-defined boolean.

  • (cs)

    I'm dying to see exactly what such a monster of Cloverfield proportions was attempting to accomplish. And the three-line method Stephan replaced it with.

  • (cs)

    It needs a preceeding comment warning the reader to take Drammamine before proceeding!

  • konrad (unregistered)

    Interesting, to say the least. Still wish we'd know what this was actually used for.

  • (cs)

    Did the writer (or should I say 'rider') win the white-and-red-dotted jersey that year?

  • (cs)

    Well shitfist me pink and fuck me rotting... I do believe this may be one of the first submissions that might be worse than the code written by a former co-worker of mine!

  • Chowlett (unregistered)

    Not to mention that's 218 lines out of the "almost 700 LoC" method. So there's not much more than twice that again of "real" code.

    The mind boggles, and not in a good way.

  • (cs)

    It looks like he missed The Tour De Finesse!

  • Ecki (unregistered)

    finally, indeed...

  • (cs)

    Finally, a representation of your average popular website's user ban policy in code form!

    (I'm a Wikipedia admin and our policy is just a little bit more comprehensible, but... =)

  • Gareth (unregistered)

    If you tilt your head to the right it looks like a panoramic ascii art landscape :)

  • Zecc (unregistered) in reply to Gareth
    Gareth:
    If you tilt your head to the right it looks like a panoramic ascii art landscape :)
    Kinda like "profile maps showing the peaks and valleys of the mountain stage", eh?
  • (cs)

    I bet it always returns FILE_NOT_FOUND

  • AC (unregistered) in reply to Gareth
    Gareth:
    If you tilt your head to the right it looks like a panoramic ascii art landscape :)

    No shit, sherlock!

  • (cs)

    My current project is to port an old C app to Java, with no spec other than "take this, port it to Java." The old app looks like this, so I'm really suspecting that mine will too.

  • Richard Pound (unregistered)

    The World Anti-Doping Agency hereby informs you that henceforth all coders will be subject to random drug tests. It is obvious that nobody could possibly have written code like this without using banned substances.

    CAPTCHA-- testosterone

  • AdT (unregistered)

    I know how this happened. The author is a member of the Church of the Flying Spaghetti Monster and shuns the evil of boolean operators or the wickedness of polymethodism.

    You guys should be ashamed of yourselves for making fun of his religion.

  • mauhiz (unregistered)

    The reader must take drugs to get through this...

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

    Perhaps a property getter.

  • anon (unregistered)

    The synchronized block wrapping the whole thing is probably very performant.

  • (cs)

    this reminds me of that old windows game where the guy skis down the slopes over hills and stuff... you know, the good old days, when movement was the arrow keys' job, not WASD...

  • Sean (unregistered)

    That looks a lot like the code I wrote for my combat engine in High School!

  • naholyr (unregistered)

    Refactoring is kind of an unknown word for too much people :(

  • Frank (unregistered)

    Never has the word 'finally' been more apt..

  • hc (unregistered)

    Give the guy a break, he's just not a big fan of composition..

    </sarcasm>
  • elias (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.

    LOL!

  • Eric (unregistered)

    Did anyone run this to get the Cyclomatic Complexity?

  • zzo38 (unregistered)

    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.

  • sweavo (unregistered)

    I've never read "finally" in code with that tone of voice before.

  • (cs) in reply to vt_mruhlin
    vt_mruhlin:
    My current project is to port an old C app to Java, with no spec other than "take this, port it to Java." The old app looks like this, so I'm really suspecting that mine will too.
    Only if the port is trivial and you're sure you won't have to maintain it in any way. Or if you lack the skill to do it better. Or if you're a masochist about working with crappy code.
  • NO no NO! (unregistered)

    First, this is really hilarious!

    Second, I have to deal with code like this all the time Java classes for 3kLoC, methods with level of block inclusion 10 or higher. Just funny stuff.

    Third, with most modern IDEs it is not so hard to write such code, but no IDE will help ya maintain it :(

  • Cloak (unregistered)

    Doping should not be prohibited in such a Tour de France.

  • Cloak (unregistered) in reply to Gareth
    Gareth:
    If you tilt your head to the right it looks like a panoramic ascii art landscape :)

    If you tilt your head to the right it would land upon my shoulder. Go away, I'm not gay.

  • (cs)

    I've seen this kind of crap before at my old job. Some developers, when given a spec, don't bother actually trying to structure the thing and do almost a 1:1 transformation from English to code. For example, in a validation method that can return either true or false, it was pretty common for the damn thing to be 1000 lines long. Each condition in the spec was another if statement. You'd wind up with something like:

    if(security.price > 100) // Case 1 { ..if(security.name == "XYZ") // special case for XYZ ..{ ..} } else // Case 2 { ..if(security.name == "XYZ") // duplicate code ugh ..{ ..} }

    So, rather than try to organize the code in a way that actually makes sense, they follow the business rules to the letter and wind up with duplicated code all over the place and 1000 line long functions that are impossible to follow unless you've got the spec right in front of you.

  • Vincent (unregistered)

    0.o

  • MrChas (unregistered)

    It would be one line in C#

  • secundum (unregistered)

    looks like someone doesn't know what methods/functions are...

    secundum

  • SomeCoder (unregistered) in reply to Eric
    Eric:
    Did anyone run this to get the Cyclomatic Complexity?

    Ok, somebody figure out the CC :) I don't really want to attempt to do it manually with THAT monstrosity but surely there are automated tools.

  • Andrey Vul (unregistered) in reply to zzo38
    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? Note: the do{ }while(false) trick I taught myself while learning obfuscation of C. However, I am Java-competent.
  • (cs)

    I like that it ends with finally. That's how you know it's over.

  • Jared (unregistered) in reply to German B.

    Its a foo property, obviously it returns bar.

  • (cs)

    It's a fractal. BFD. I write code that looks like the Mandelbrot set...

    </math_joke>

  • Matt (unregistered)

    Stick that thing on it's side and let's play Defender, baby!

  • Alex (unregistered)

    If you scroll down it quickly, it looks almost like a strand of DNA...

  • rast (unregistered)

    This isn't much worse than Nethack's code.

  • iToad (unregistered) in reply to SomeCoder
    SomeCoder:
    Eric:
    Did anyone run this to get the Cyclomatic Complexity?

    Ok, somebody figure out the CC :) I don't really want to attempt to do it manually with THAT monstrosity but surely there are automated tools.

    The Cyclomatic Complexity appears to be approximately +INF.

  • E (unregistered) in reply to brazzy

    Or looking for long term job security via code obscurity

  • Alcari (unregistered)

    Tour de farce, more likely.

    Please tell me nobody codes like this. How the hell did they manage to get it to work?

  • bcharr2 (unregistered)

    If you can't code smart, you might as well obfuscate. Remember, obfuscation may not prove how smart you are, but it might just hide how dumb you are.

  • KT (unregistered) in reply to MrChas

    public boolean foo() { try { synchronized () { if () { } else { } for () { if () { if () { ......

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

Log In or post as a guest

Replying to comment #173685:

« Return to Article