Comment On Coding Like the Tour de France

Last year, while watching coverage of the Tour de France, Stephan M noticed something a little strange. If he tilted his head by 90° and squinted just a bit, the profile maps showing the peaks and valleys of the mountain stage looked rather familiar. They were just like the monstrous routines written by his predecessor - the very same coder behind the Quadrasort. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Coding Like the Tour de France

2008-01-28 08:01 • by Vollhorst (unregistered)
He should be happy it doesn't return a self-defined boolean.

Re: Coding Like the Tour de France

2008-01-28 08:03 • by Someone You Know
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.

Re: Coding Like the Tour de France

2008-01-28 08:08 • by snoofle
It needs a preceeding comment warning the reader to take Drammamine before proceeding!

Re: Coding Like the Tour de France

2008-01-28 08:13 • by konrad (unregistered)
Interesting, to say the least. Still wish we'd know what this was actually used for.

Re: Coding Like the Tour de France

2008-01-28 08:14 • by JiP
Did the writer (or should I say 'rider') win the white-and-red-dotted jersey that year?

Re: Coding Like the Tour de France

2008-01-28 08:19 • by Morbii
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!

Re: Coding Like the Tour de France

2008-01-28 08:20 • by 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.

Re: Coding Like the Tour de France

2008-01-28 08:24 • by ParkinT
It looks like he missed The Tour De Finesse!

Re: Coding Like the Tour de France

2008-01-28 08:25 • by Ecki (unregistered)
finally, indeed...

Re: Coding Like the Tour de France

2008-01-28 08:27 • by WWWWolf
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... =)

Re: Coding Like the Tour de France

2008-01-28 08:31 • by Gareth (unregistered)
If you tilt your head to the right it looks like a panoramic ascii art landscape :)

Re: Coding Like the Tour de France

2008-01-28 08:44 • by Zecc (unregistered)
173649 in reply to 173648
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?

Re: Coding Like the Tour de France

2008-01-28 08:50 • by Manos
I bet it always returns FILE_NOT_FOUND

Re: Coding Like the Tour de France

2008-01-28 08:52 • by AC (unregistered)
173651 in reply to 173648
Gareth:
If you tilt your head to the right it looks like a panoramic ascii art landscape :)


No shit, sherlock!

Re: Coding Like the Tour de France

2008-01-28 08:56 • by 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.

Re: Coding Like the Tour de France

2008-01-28 09:00 • by 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

Re: Coding Like the Tour de France

2008-01-28 09:01 • by 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.

Re: Coding Like the Tour de France

2008-01-28 09:02 • by mauhiz (unregistered)
The reader must take drugs to get through this...

Re: Coding Like the Tour de France

2008-01-28 09:10 • by German B. (unregistered)
173658 in reply to 173640
konrad:
Interesting, to say the least. Still wish we'd know what this was actually used for.


Perhaps a property getter.

Re: Coding Like the Tour de France

2008-01-28 09:10 • by anon (unregistered)
The synchronized block wrapping the whole thing is probably very performant.

Re: Coding Like the Tour de France

2008-01-28 09:12 • by rawsteak
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...

Re: Coding Like the Tour de France

2008-01-28 09:18 • by Sean (unregistered)
That looks a lot like the code I wrote for my combat engine in High School!

Re: Coding Like the Tour de France

2008-01-28 09:26 • by naholyr (unregistered)
Refactoring is kind of an unknown word for too much people :(

Re: Coding Like the Tour de France

2008-01-28 09:26 • by Frank (unregistered)
Never has the word 'finally' been more apt..

Re: Coding Like the Tour de France

2008-01-28 09:40 • by hc (unregistered)
Give the guy a break, he's just not a big fan of composition..

</sarcasm>

Re: Coding Like the Tour de France

2008-01-28 09:45 • by elias (unregistered)
173665 in reply to 173658
German B.:
konrad:
Interesting, to say the least. Still wish we'd know what this was actually used for.


Perhaps a property getter.

LOL!

Re: Coding Like the Tour de France

2008-01-28 09:46 • by Eric (unregistered)
Did anyone run this to get the Cyclomatic Complexity?

Re: Coding Like the Tour de France

2008-01-28 09:53 • by 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.

Re: Coding Like the Tour de France

2008-01-28 09:54 • by sweavo (unregistered)
I've never read "finally" in code with that tone of voice before.

Re: Coding Like the Tour de France

2008-01-28 09:54 • by brazzy
173669 in reply to 173652
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.

Re: Coding Like the Tour de France

2008-01-28 09:58 • by 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 :(

Re: Coding Like the Tour de France

2008-01-28 10:01 • by Cloak (unregistered)
Doping should not be prohibited in such a Tour de France.

Re: Coding Like the Tour de France

2008-01-28 10:03 • by Cloak (unregistered)
173672 in reply to 173648
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.

Re: Coding Like the Tour de France

2008-01-28 10:10 • by Outlaw Programmer
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.

Re: Coding Like the Tour de France

2008-01-28 10:16 • by Vincent (unregistered)
0.o

Re: Coding Like the Tour de France

2008-01-28 10:19 • by MrChas (unregistered)
It would be one line in C#

Re: Coding Like the Tour de France

2008-01-28 10:22 • by secundum (unregistered)
looks like someone doesn't know what methods/functions are...

secundum

Re: Coding Like the Tour de France

2008-01-28 10:31 • by SomeCoder (unregistered)
173684 in reply to 173666
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.

Re: Coding Like the Tour de France

2008-01-28 10:33 • by Andrey Vul (unregistered)
173685 in reply to 173667
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.

Re: Coding Like the Tour de France

2008-01-28 10:38 • by Bavobbr
I like that it ends with finally. That's how you know it's over.

Re: Coding Like the Tour de France

2008-01-28 10:40 • by Jared (unregistered)
173690 in reply to 173658
Its a foo property, obviously it returns bar.

Re: Coding Like the Tour de France

2008-01-28 10:51 • by GalacticCowboy
It's a fractal. BFD. I write code that looks like the Mandelbrot set...

</math_joke>

Re: Coding Like the Tour de France

2008-01-28 10:52 • by Matt (unregistered)
Stick that thing on it's side and let's play Defender, baby!

Re: Coding Like the Tour de France

2008-01-28 10:54 • by Alex (unregistered)
If you scroll down it quickly, it looks almost like a strand of DNA...

Re: Coding Like the Tour de France

2008-01-28 11:05 • by rast (unregistered)
This isn't much worse than Nethack's code.

Re: Coding Like the Tour de France

2008-01-28 11:37 • by iToad (unregistered)
173714 in reply to 173684
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.

Re: Coding Like the Tour de France

2008-01-28 11:37 • by E (unregistered)
173715 in reply to 173669
Or looking for long term job security via code obscurity

Re: Coding Like the Tour de France

2008-01-28 11:40 • by 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?

Re: Coding Like the Tour de France

2008-01-28 12:16 • by 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.

Re: Coding Like the Tour de France

2008-01-28 12:28 • by KT (unregistered)
173725 in reply to 173678
public boolean foo() { try { synchronized () { if () { } else { } for () { if () { if () { ......
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment