• Mr (unregistered)

    err. arrhh . i'm first but I have nothing to say :(

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

  • 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!

  • (cs)

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

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

  • aaberg (unregistered)

    Just looking at this code, makes my head hurt!!

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

  • MarkG (unregistered)

    Can't help admire the great indentation.

  • (cs)

    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 ;)

  • ClaudeSuck.de (unregistered) in reply to dkf
    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.

  • Mortal (unregistered) in reply to ClaudeSuck.de
    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.

  • Thomas Materna (unregistered)

    What are you guys complaining about? The code is well indented for maximum readability ;-)

  • @Deprecated (unregistered) in reply to dkf
    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."

  • (cs) in reply to Thomas Materna
    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.

  • Jemmy (unregistered) in reply to snoofle

    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.

  • (cs) in reply to ClaudeSuck.de
    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.

  • Talking Head (unregistered)

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

  • (cs) in reply to Talking Head
    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.
  • ClaudeSuck.de (unregistered) in reply to Mortal
    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?

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

  • (cs)

    Arrow code. Gotta love it!

  • (cs) in reply to Mr
    Mr :
    err. arrhh . i'm first but I have nothing to say :(
    I appreciate your honesty
  • (cs)

    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"

  • MikeR (unregistered)

    It doesn't look so bad when you shrink the font size of that block of code to miniscule proportions...

    See?

  • (cs)

    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.

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

  • mucki (unregistered)

    O(n^^18), because sometimes P is almost NP :)

  • (cs) in reply to MarkG
    MarkG:
    Can't help admire the great indentation.

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

  • (cs)

    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

  • Data Monkey (unregistered) in reply to Cro
    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.
  • Anonymous (unregistered) in reply to Talking Head
    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!
  • (cs) in reply to ClaudeSuck.de
    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).
  • Hash Cash (unregistered) in reply to ubersoldat
    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.
  • Anonymous coward (unregistered) in reply to Data Monkey

    What do you expect me to do?

    Put a damn primary key on your customer id field maybe?

  • EatenByAGrue (unregistered) in reply to Hash Cash
    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.

  • persto (unregistered) in reply to Anonymous coward

    Clearly a case of

    O( n^toomuch )
    becoming
    O( screw it ( let's go drink^toomuch ) )

  • Marvin the Martian (unregistered) in reply to MikeR
    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

  • AdT (unregistered) in reply to kastein
    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€.

  • (cs)
    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.

  • daniel c w (unregistered)

    I don't realy get the WTF, seriously

    Could somebody please explain?

  • Lee K-T (unregistered) in reply to AdT
    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

  • (cs)

    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.

  • Steve the Cynic (unregistered) in reply to Smash King
    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...

  • Chelloveck (unregistered) in reply to Talking Head

    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.

  • (cs)

    "job responsibly include... some maintenance of legacy VB6 applications"

    Y'know, I'm reasonably certain that word should be "responsibilities".

  • Right Wing-Nut (unregistered) in reply to Marvin the Martian
    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.

  • kitzkar (unregistered)

    Wow... It's the first time I've seen an O(n^18) algorithm.

  • An Onymous (unregistered)

    The road to Hell is paved with good indentions.

  • BillyD (unregistered) in reply to MikeR

    Brilliant!!

  • (cs) in reply to daniel c w
    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.

Leave a comment on “For The Love Of...”

Log In or post as a guest

Replying to comment #269851:

« Return to Article