- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
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.
Admin
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
Admin
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?
Admin
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 { } { } { { } { } } } }
Admin
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.
Admin
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.
Admin
He could have condensed
to
and then it would have cleared up all confusion.
Admin
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.
Admin
Admin
по 5 ифов подряд и не одного кейса... что ж там там за логика такая была...
Admin
по 5 ифов подряд и не одного кейса... что ж там там за логика такая была...
Admin
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.
Admin
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.
Admin
I once wrote a downhill skiing game for the ZX Spectrum. It looked a lot like this.
Admin
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.
Admin
That is quite probably the most appropriate use of the "finally" keyword ever.
Admin
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.
Admin
I like the fact that it ends with "finally"!
Admin
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!