Comment On For The Love Of...

To many people, including Ron Owens, the word "some" refers to a relatively small amount in between "none" and "most". But To Ron's employer, and especially in the context of "job responsibly include... some maintenance of legacy VB6 applications", the word "some" tends to mean "pretty much all day long for the indefinite future." [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: For The Love Of...

2009-06-17 08:05 • by Mr (unregistered)
err. arrhh . i'm first but I have nothing to say :(

Re: For The Love Of...

2009-06-17 08:06 • by aremmes (unregistered)
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.

Re: For The Love Of...

2009-06-17 08:08 • by Steve the Cynic (unregistered)
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!

Re: For The Love Of...

2009-06-17 08:12 • by dkf
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...

Re: For The Love Of...

2009-06-17 08:16 • by Wheaties (unregistered)
They should hire me. I bet I could put in a few more foreach's and then feign ignorance when presented with my work.

Re: For The Love Of...

2009-06-17 08:21 • by aaberg (unregistered)
Just looking at this code, makes my head hurt!!

Re: For The Love Of...

2009-06-17 08:21 • by Mortal (unregistered)
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...

Re: For The Love Of...

2009-06-17 08:23 • by MarkG (unregistered)
Can't help admire the great indentation.

Re: For The Love Of...

2009-06-17 08:25 • by snoofle
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)
269804 in reply to 269795
dkf:
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...


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)
269807 in reply to 269804
ClaudeSuck.de:
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.


I don't hope a single insertion takes as long as 0.1 seconds.

Re: For The Love Of...

2009-06-17 08:38 • by Thomas Materna (unregistered)
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)
269811 in reply to 269795
dkf:
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...


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."

Re: For The Love Of...

2009-06-17 08:44 • by steenbergh
269813 in reply to 269809
Thomas Materna:
What are you guys complaining about? The code is well indented for maximum readability ;-)


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)
269814 in reply to 269803
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.

Re: For The Love Of...

2009-06-17 08:45 • by Smash King
269815 in reply to 269804
ClaudeSuck.de:
dkf:
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...


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.
No, wait. Since the system will keep working during lunchtime, you should spend two hours choosing the right combinations.

Re: For The Love Of...

2009-06-17 08:53 • by Talking Head (unregistered)
The problem is the two spaces indent. If you only use one space, it won't be nested nearly so deep.

Re: For The Love Of...

2009-06-17 08:57 • by jimlangrunner
269820 in reply to 269818
Talking Head:
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)
269823 in reply to 269807
Mortal:
ClaudeSuck.de:
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.


I don't hope a single insertion takes as long as 0.1 seconds.


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?

Re: For The Love Of...

2009-06-17 09:07 • by Data Monkey (unregistered)
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...)

Re: For The Love Of...

2009-06-17 09:13 • by Vilx-
Arrow code. Gotta love it!

Re: For The Love Of...

2009-06-17 09:15 • by keeperofkeys
269829 in reply to 269790
Mr :
err. arrhh . i'm first but I have nothing to say :(

I appreciate your honesty

Re: For The Love Of...

2009-06-17 09:17 • by ObiWayneKenobi
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"

Re: For The Love Of...

2009-06-17 09:22 • by MikeR (unregistered)
It doesn't look so bad when you shrink the font size of that block of code to miniscule proportions...

>

See?

Re: For The Love Of...

2009-06-17 09:29 • by Voodoo Coder
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.

Re: For The Love Of...

2009-06-17 09:29 • by HeHe (unregistered)
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"

Re: For The Love Of...

2009-06-17 09:37 • by mucki (unregistered)
O(n^^18), because sometimes P is almost NP :)

Re: For The Love Of...

2009-06-17 09:37 • by Cro
269839 in reply to 269801
MarkG:
Can't help admire the great indentation.


It's not what you did, it's the indention that counts...

Re: For The Love Of...

2009-06-17 09:41 • by ubersoldat
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)
269842 in reply to 269839
Cro:
It's not what you did, it's the indention that counts...

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)
269843 in reply to 269818
Talking Head:
The problem is the two spaces indent. If you only use one space, it won't be nested nearly so deep.
Comment of the day!

Re: For The Love Of...

2009-06-17 09:44 • by kastein
269844 in reply to 269804
ClaudeSuck.de:
dkf:
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...


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.
... 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

Talking Head:
The problem is the two spaces indent. If you only use one space, it won't be nested nearly so deep.
hahahaha, you win.

mucki:
O(n^^18), because sometimes P is almost NP :)
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)
269845 in reply to 269841
ubersoldat:
the 53 arguments function... priceless

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)
269846 in reply to 269824
>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)
269849 in reply to 269845
Hash Cash:
ubersoldat:
the 53 arguments function... priceless

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.


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)
269850 in reply to 269846
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)
269851 in reply to 269832
MikeR:
It doesn't look so bad when you shrink the font size of that block of code to miniscule proportions...

>

See?

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)
269853 in reply to 269844
kastein:
I know you crazy europeans use the decimal point as a thousands seperator as well as a radix point, but wtf? :P


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€.

Re: For The Love Of...

2009-06-17 10:06 • by cod3_complete
To Ron's employer, and especially in the context of "job responsibly include... some maintenance of legacy VB6 applications", the word "some" tends to mean "pretty much all day long for the indefinite future."


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.

Re: For The Love Of...

2009-06-17 10:20 • by daniel c w (unregistered)
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)
269861 in reply to 269853
AdT:
kastein:
I know you crazy europeans use the decimal point as a thousands seperator as well as a radix point, but wtf? :P


Technically, the only European countries that use a decimal point (as opposed to decimal comma) are... ...Switzerland.


No we don't

Re: For The Love Of...

2009-06-17 10:25 • by Smash King
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)
269868 in reply to 269862
Smash King:
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.


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)
269870 in reply to 269818
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.

Re: For The Love Of...

2009-06-17 10:39 • by Zylon
"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)
269872 in reply to 269851
Marvin the Martian:
MikeR:
It doesn't look so bad when you shrink the font size of that block of code to miniscule proportions...

>

See?

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


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.

Re: For The Love Of...

2009-06-17 10:44 • by kitzkar (unregistered)
Wow... It's the first time I've seen an O(n^18) algorithm.

Re: For The Love Of...

2009-06-17 10:47 • by An Onymous (unregistered)
The road to Hell is paved with good indentions.

Re: For The Love Of...

2009-06-17 10:49 • by BillyD (unregistered)
269877 in reply to 269832
Brilliant!!

Re: For The Love Of...

2009-06-17 10:59 • by pitchingchris
269880 in reply to 269860
daniel c w:
I don't realy get the WTF, seriously

Could somebody please explain?


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.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment