- 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
err. arrhh . i'm first but I have nothing to say :(
Admin
Where did the idea for this code come from? Did someone point a video camera at its own monitor and thought, "Hey, I've got an idea!"?
Looking at it makes me sad like the guy in the Splunk ad.
Admin
I like the appearance of a stepped-pyramid, makes me think of those ziggurat things in Central America. The ones with the human sacrifices and all that.
Kind of appropriate here. The human sacrifice part, that is.
Oh, yes, (small number)th!
Admin
18 'For Each'es? If they all have at least some valued purpose in being there (i.e. they're not operating over singleton sets) then that means there's at least 2**18 calls to 'InsertRule'. That might take some time...
Admin
They should hire me. I bet I could put in a few more foreach's and then feign ignorance when presented with my work.
Admin
Just looking at this code, makes my head hurt!!
Admin
Why would you ever need a list of rules that include all permutations of 18 listboxes? If "Temp" in TempDel stands for Temporary, then that'll hardly be true, because that code block will take some time to execute...
Admin
Can't help admire the great indentation.
Admin
We have something similar in our codebase, albeit in Java. Some fool discovers that you can turn pretty much anything into a list, and so makes the code "generic" by iterating over lists that are presently known to contain 1 item, but which might someday contain more.
One great example, in pseudo code:
for (DayOfWeek dow : businessDays.getToday()) { ... }
...cuz someday, today might be more than one day ;)
Admin
2^18 is merely 262.144 inserts. Let one take 0.1 seconds then after some 7 hours your done saving them. Let there be one hour to choose the right combinations and you have WORKED AN ENTIRE DAY.
Admin
I don't hope a single insertion takes as long as 0.1 seconds.
Admin
What are you guys complaining about? The code is well indented for maximum readability ;-)
Admin
I can't decide which is worse... 18 levels of loops, or a function that takes 53 arguments... sure is purdy, though!
All that is missing is a comment trying to explain how it won't consume the CPU for days, it is of order Log(n), or how about "It's single threaded, so if you're on a multi-core machine, you'll be just fine."
Admin
You're right, unfortunately. I would prefer this code to be all garbled up, so the horror remains hidden...
At least this loop isn't infinite.
Admin
Well, if you can for-loop over it like this, it already is an Iterable (otherwise it doesn't compile), so writing it like this makes more sense to me than "businessDays.getToday().get(0)". Then again, if there's some constraint that .getToday() is always a collection of 1, it should be typed directly as DayOfWeek instead of List.
Admin
Admin
The problem is the two spaces indent. If you only use one space, it won't be nested nearly so deep.
Admin
Admin
I hope there are only 2 possibilities for each. What about 3^^18 or 4^^18 (or n^^18) given that they are all list views?
Admin
For consistency, I always iterate the results of a database query, even if I'm only expecting one row. For example, if there are three customers with the same customer ID, I ship an identical order to all three of them.
What do you expect me to do? Randomly send everything to the first one? Design specs rarely address cases like this... (grumble...)
Admin
Arrow code. Gotta love it!
Admin
Admin
If anyone EVER says "oh, and the job will also include minor work in <insert legacy tech here>" then RUN AWAY. This always means "You came here thinking you'd work with cool new stuff, but instead we need a sucker^H^H^H^H^H^Hemployee to work on our legacy shit"
Admin
It doesn't look so bad when you shrink the font size of that block of code to miniscule proportions...
See?
Admin
This kind of code reminds me of those houses you see around Christmas time...with all of the tackiest Big Lots decor they could find, haphazardly scattered around the yard, roof and wherever else the wind blows it.
It makes me wonder if the person behind it spent all day (possibly more..?)doing it...then stood back and looked at at it, letting out the contented "sigh" of a job well done, smiling while naively admiring the abominable crime against nature they have just created.
Admin
I like the nice way the code makes this smooth incline - kinda makes the whole appearance pleasing. We could probably push it off to a bunch of suits as "Neat code"
Admin
O(n^^18), because sometimes P is almost NP :)
Admin
It's not what you did, it's the indention that counts...
Admin
I can't believe someone who at least has read a book on programming would think about writing this kind of crap. Actually, IDEs should forbid this kind of coding by default and punch in the face.
Oh! And the 53 arguments function... priceless
Admin
Admin
Admin
I know you crazy europeans use the decimal point as a thousands seperator as well as a radix point, but wtf? :P
hahahaha, you win. I believe this is generally known as O(scary) or O(mygod), or possibly in extreme cases O(wtf).Admin
Admin
Put a damn primary key on your customer id field maybe?
Admin
No, you need to rethink your design so that there isn't a massive data structure that needs to be accessed from lots of places. Modularize, people.
Admin
Clearly a case of
becomingAdmin
Admin
Technically, the only European countries that use a decimal point (as opposed to decimal comma) are UK, Ireland and Switzerland.
However, it's easy for the rest of us to get things mixed up when trying to use the English notation. The fact that some computer applications are locale-aware and may expect a decimal comma, while others (notably programming languages) are locale-ignorant and always expect a decimal point, doesn't help.
Just my 0,02€.
Admin
The true WTF is that so many companies insist on maintaining vb6 apps instead of rightly dumping them for the garbage they are. I've had the displeasure of being forced to use many apps written in vb6 and none of them have been reliable. Just take a fresh RAID can to these buggy apps and call it a day.
Admin
I don't realy get the WTF, seriously
Could somebody please explain?
Admin
No we don't
Admin
We all might have been missing something here...
Almost all of the list indexes on that function call are a constant 1 . It seems probable that most of those lists will ALWAYS have a single element on it - and the programmer knows it, because he would use variable list indexes otherwise.
Admin
Not quite. The lists have some unknown number of items, and each item has an unknown number of subitems, but the ziggurat only looks at the first subitem of each item...
Admin
You joke, but I've been there. I was working on someone else's code (not mine, I swear!) and having a hell of a time following it. So I ran it through a pretty-printer, with a one-space indent level. The innermost block of the main loop had more than 80 columns of leading whitespace. That's right, looping and control structures nested more than 80 deep.
And this was C++. Well, at least nominally. It compiled with a C++ compiler, anyway.
And yes, it was in a real product and was still that way when it went to market. If you must know, it was a game for the original PlayStation. And that's all I'm sayin', lest the Sony Hit Squad come after me.
Admin
"job responsibly include... some maintenance of legacy VB6 applications"
Y'know, I'm reasonably certain that word should be "responsibilities".
Admin
Never mind that. To truly understand the significance of the code, you need to view it sideways. From one side, it is a bird of prey, screaming as it descends on your sanity. From the other, it is an alien invasion machine. You think you can disable it by uploading a virus, but if you do, the entire structure will collapse on your sanity.
Admin
Wow... It's the first time I've seen an O(n^18) algorithm.
Admin
The road to Hell is paved with good indentions.
Admin
Brilliant!!
Admin
The explanation is too freaking long to start, and we've already pointed out most of the flaws. The 58 arguments is definitely a WTF, and its a LOOOONG stretch that anybody realistically had to run the same function on all those collections. Even if he did, an error in one, will probably blow the next if they are not careful, so there is no way to tell what failed. The list goes on and on.