| « Prev | Page 1 | Page 2 | Page 3 | Next » |
|
err. arrhh . i'm first but I have nothing to say :(
|
|
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. |
|
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! |
|
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...
|
|
They should hire me. I bet I could put in a few more foreach's and then feign ignorance when presented with my work.
|
|
Just looking at this code, makes my head hurt!!
|
|
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...
|
|
Can't help admire the great indentation.
|
|
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 ;) |
Re: For The Love Of...
2009-06-17 08:30
•
by
ClaudeSuck.de
(unregistered)
|
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. |
Re: For The Love Of...
2009-06-17 08:36
•
by
Mortal
(unregistered)
|
I don't hope a single insertion takes as long as 0.1 seconds. |
|
What are you guys complaining about? The code is well indented for maximum readability ;-)
|
Re: For The Love Of...
2009-06-17 08:42
•
by
@Deprecated
(unregistered)
|
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." |
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. |
Re: For The Love Of...
2009-06-17 08:45
•
by
Jemmy
(unregistered)
|
|
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.
|
No, wait. Since the system will keep working during lunchtime, you should spend two hours choosing the right combinations. |
|
The problem is the two spaces indent. If you only use one space, it won't be nested nearly so deep.
|
Thanks so much for the coffee on my monitor. |
Re: For The Love Of...
2009-06-17 09:03
•
by
ClaudeSuck.de
(unregistered)
|
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? |
|
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...) |
I appreciate your honesty |
|
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"
|
|
It doesn't look so bad when you shrink the font size of that block of code to miniscule proportions...
> See? |
|
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. |
|
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"
|
|
O(n^^18), because sometimes P is almost NP :)
|
It's not what you did, it's the indention that counts... |
|
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 |
Re: For The Love Of...
2009-06-17 09:42
•
by
Data Monkey
(unregistered)
|
If you happened to be a hot chick in one of the programming classes I took, then yes, indentation would have been sufficient. |
Re: For The Love Of...
2009-06-17 09:42
•
by
Anonymous
(unregistered)
|
Comment of the day! |
... so that's 262.144 seconds and each one taking 0.1 seconds? or 0.100 seconds? is that equivalent to one tenth or one hundred? 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). |
Re: For The Love Of...
2009-06-17 09:45
•
by
Hash Cash
(unregistered)
|
Whenever you see a function with more than about 8 args, it is time to rethink your design -- maybe a global hash, so you don't have to keep passing all that data back and forth. |
Re: For The Love Of...
2009-06-17 09:55
•
by
Anonymous coward
(unregistered)
|
|
>What do you expect me to do?
Put a damn primary key on your customer id field maybe? |
Re: For The Love Of...
2009-06-17 10:01
•
by
EatenByAGrue
(unregistered)
|
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. |
Re: For The Love Of...
2009-06-17 10:03
•
by
persto
(unregistered)
|
|
Clearly a case of
O( n^toomuch )becoming O( screw it ( let's go drink^toomuch ) ) |
Re: For The Love Of...
2009-06-17 10:05
•
by
Marvin the Martian
(unregistered)
|
Thanks. Now every time I see a shell prompt, I'll imagine it's such a horror masked by small font, and lo(o)se my mind soon enough |
Re: For The Love Of...
2009-06-17 10:05
•
by
AdT
(unregistered)
|
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€. |
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. |
|
I don't realy get the WTF, seriously
Could somebody please explain? |
Re: For The Love Of...
2009-06-17 10:24
•
by
Lee K-T
(unregistered)
|
No we don't |
|
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. |
Re: For The Love Of...
2009-06-17 10:30
•
by
Steve the Cynic
(unregistered)
|
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... |
Re: For The Love Of...
2009-06-17 10:39
•
by
Chelloveck
(unregistered)
|
|
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. |
|
"job responsibly include... some maintenance of legacy VB6 applications"
Y'know, I'm reasonably certain that word should be "responsibilities". |
Re: For The Love Of...
2009-06-17 10:41
•
by
Right Wing-Nut
(unregistered)
|
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. |
|
Wow... It's the first time I've seen an O(n^18) algorithm.
|
|
The road to Hell is paved with good indentions.
|
Re: For The Love Of...
2009-06-17 10:49
•
by
BillyD
(unregistered)
|
|
Brilliant!!
|
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. |
| « Prev | Page 1 | Page 2 | Page 3 | Next » |