• (cs)

    Is this some of that new-fangled "No SQL" stuff?

  • Ken B. (unregistered)
    Thrilled to have such tangible, immediate results at their fingertips, management showered Chris with accolades galore.
    TRWTF is that you think we'd believe that management would do such a thing.

    Actually, they reprimanded him for making $BOSS->$BOSS->Offspring[1] (aka "the brilliant programmer who wrote the original code") look bad.

  • Natural Born Complainer (unregistered)

    I used to work for a company where every access to the data was done like in this example. Foreach, foreach, foreach... So slow that showing the contact details of about 400 people took half an hour. In my case, unfortunately, I was forbidden to make any change, because "they always did like that". Solution was: customer will wait.

    Oh, and their "caching" solution, of fetching an arbitrary amount of records before and after the requested one, just in case...

  • Markus (unregistered) in reply to frits
    frist:
    Is this some of that new-fangled "No SQL" stuff?

    FTFY (Username) ;)

  • (cs)

    I'm the type of developer that likes to do a lot of things in the program's code and keep the SQL as simple as possible, but even I'll have to admit that this code sample is a little overdone in that respect.

  • (cs)

    Sadly it's not always an option to use sql when the data is stored in memory in a structure like this.

  • SQL Maven (unregistered) in reply to steenbergh
    steenbergh:
    I'm the type of developer that likes to do a lot of things in the program's code and keep the SQL as simple as possible, but even I'll have to admit that this code sample is a little overdone in that respect.
    Right, because those INNER JOINs are so damned complicated.
  • Electro Protonucleus (unregistered) in reply to Ken B.
    Ken B.:
    Thrilled to have such tangible, immediate results at their fingertips, management showered Chris with accolades galore.
    TRWTF is that you think we'd believe that management would do such a thing.

    Actually, they reprimanded him for making $BOSS->$BOSS->Offspring[1] (aka "the brilliant programmer who wrote the original code") look bad.

    TRWTF is the programming language you seem to be using.

  • Aether (unregistered) in reply to Ken B.
    Ken B.:
    Thrilled to have such tangible, immediate results at their fingertips, management showered Chris with accolades galore.
    TRWTF is that you think we'd believe that management would do such a thing.

    Actually, they reprimanded him for making $BOSS->$BOSS->Offspring[1] (aka "the brilliant programmer who wrote the original code") look bad.

    That was only after several demonstrations showing that the output was, in fact, correct, because if it's running that fast, how can it actually be doing it right?

  • drusi (unregistered)

    The ending to this one is rather refreshing.

  • Zen Grasshopper (unregistered) in reply to steenbergh
    steenbergh:
    I'm the type of developer that likes to do a lot of things in the program's code and keep the SQL as simple as possible, but even I'll have to admit that this code sample is a little overdone in that respect.

    There is a place for everything; sometimes it is far better to off-load the work to the SQL server, and sometimes it is better to use the compiler.

  • Clumsy Kid (unregistered) in reply to Aether
    Aether:
    That was only after several demonstrations showing that the output was, in fact, correct, because if it's running that fast, how can it actually be doing it right?

    What management would not want proper testing to show them that the end result is still the same?

  • (cs)

    Clearly, TRWTF is that Chris didn't save his fix and dole it out slowly over a year. Imagine if every month he removed just one for loop and slightly expanded the SQL? Instead he blew his wad on a single fix! Amateur.

  • Zen Grasshopper (unregistered) in reply to Bumble Bee Tuna
    Bumble Bee Tuna:
    Clearly, TRWTF is that Chris didn't save his fix and dole it out slowly over a year. Imagine if every month he removed just one for loop and slightly expanded the SQL? Instead he blew his wad on a single fix! Amateur.

    Premature optimization? Don't they have a medication for that?

  • Scott (unregistered) in reply to Clumsy Kid
    What management would not want proper testing to show them that the end result is still the same?
    Actually, if the original report was reading the DB over an 8 hour period, they don't want the new report to be the same. The original report would have data skewed from agent to agent as their queues changed through the day. The new report should provide a more accurate snapshot.

    Of course, it would be surprising if management figured out how to test the new report to make sure it's correct. I'm sure someone complained that it didn't match the old report.

  • (cs) in reply to Zen Grasshopper
    Zen Grasshopper:
    Premature optimization? Don't they have a medication for that?

    Ask your doctor if Optimator is right for you. And remember, IT advice should be sought immediately for report generation lasting more than four hours.

  • Nagesh Kukunoor (unregistered)

    TRWTF is that if he had simply used simple stored procedure, he would have save even more time.

  • Anonymous (unregistered)

    Holy crap, it's like a taco inside a taco inside a Taco Bell inside a KFC in a mall in your dream!

  • (cs) in reply to dgvid
    dgvid:
    Zen Grasshopper:
    Premature optimization? Don't they have a medication for that?

    Ask your doctor if Optimator is right for you. And remember, IT advice should be sought immediately for report generation lasting more than four hours.

    +1

  • (cs)

    Reminds me of an XML horror I encountered a while ago. Rather than make sane of selectNodes(), firstChild() etc., a now ex-colleague in another country decided to iterate over every single node in the DOM, checking each to see if it was the right type. On finding a node of interest, he then iterated over every node in the tree again, checking each to see if it was the (only) child of the original. On finding the child, he then continued to check that all the remaining nodes definitely weren't also children.

    And for every query into the DOM, he'd read and parse the whole thing from file again...

    Completely coincidentally, the very day he proclaimed to the CEO that the startup of the complete system was "already as fast as it could be" was the same day another colleague and I spent an afternoon looking at the problem and knocked 90% off the time by altering that single function.

  • (cs) in reply to cjl
    cjl:
    ... Completely coincidentally, the very day he proclaimed to the CEO that the startup of the complete system was "already as fast as it could be" was the same day another colleague and I spent an afternoon looking at the problem and knocked 90% off the time by altering that single function.

    In my experience, from both observed and personally-executed, this type of behavior usually occurs when somebody is first learning XYZ technology. As far as they know, they are doing the Right Thing (TM), and as far they know, it probably is as fast as it can be, given how it was implemented. As they say, or as I say, if it isn't broke, optimize it! :)

  • 3rd Ferguson (unregistered)
    ...queries their queues...
    ...queries their queues...

    Hmm...

    A quarrelsome quest for questionable queries! A quotidian quagmire quickly makes quad-cores querulous. But quality code quashes quackery.

    Let's quit and quaff!

    /14 layers of queues?

  • Sudo (unregistered) in reply to Ken B.
    Ken B.:
    Thrilled to have such tangible, immediate results at their fingertips, management showered Chris with accolades galore.
    TRWTF is that you think we'd believe that management would do such a thing.

    Actually, they reprimanded him for making $BOSS->$BOSS->Offspring[1] (aka "the brilliant programmer who wrote the original code") look bad.

    I disagree. I my experience, "truly" tangible results like this do tend to impress management. For instance, when I once made changes to an Access DB to change it's state from "useless" to "workable", I was treated like a conquering hero for a day or two. Of course, it doesn't last, but that's not the point...

  • d.k. Allen (unregistered) in reply to 3rd Ferguson
    3rd Ferguson:
    ...queries their queues...
    ...queries their queues...

    Hmm...

    A quarrelsome quest for questionable queries! A quotidian quagmire quickly makes quad-cores querulous. But quality code quashes quackery.

    Let's quit and quaff!

    /14 layers of queues?

    Quit it.

  • Nagesh Kukunoor (unregistered)

    Did they find the original programmer who wrote that logic?

    CAPTCHA: dolor - This makes me sad.

  • imgx64 (unregistered) in reply to Electro Protonucleus
    Electro Protonucleus:
    Ken B.:
    Thrilled to have such tangible, immediate results at their fingertips, management showered Chris with accolades galore.
    TRWTF is that you think we'd believe that management would do such a thing.

    Actually, they reprimanded him for making $BOSS->$BOSS->Offspring[1] (aka "the brilliant programmer who wrote the original code") look bad.

    TRWTF is the programming language you seem to be using.

    This is either Perl (which I don't know much about) or PHP (which I used before it got all this fancy OO stuff). Either way, I don't think the second $BOSS should have $, but I could be wrong.

  • boog (unregistered) in reply to Nagesh Kukunoor
    Nagesh Kukunoor:
    Did they find the original programmer who wrote that logic?

    CAPTCHA: dolor - This makes me sad.

    I'm pretty sure I strangled him with a penguin before he made it out the door.

  • Timmorn (unregistered) in reply to Anonymous
    Anonymous:
    Holy crap, it's like a taco inside a taco inside a Taco Bell inside a KFC in a mall in your dream!
    ... in a dream.

    You need to go deeper!

  • (cs) in reply to Scott
    Scott:
    Of course, it would be surprising if management figured out how to test the new report to make sure it's correct. I'm sure someone complained that it didn't match the old report.
    No doubt. The struggles with answering those complainers are never-ending. "I don't think this report is correct." "Here's the documentation of exactly where all of the numbers on it come from." "I can't figure that stuff out, but I just don't think the report is right." "Why not?" "Well, it doesn't match the numbers on this other report." "Where do the numbers on that report come from?" "I don't know." "Then what makes you think those numbers are correct?" "We've been using that report for years! It must be right!" "I have another theory. It's that you've been managing to inaccurate data for years and never noticed." "You're not a team player." :(
  • (cs)

    Perhaps the original developer didn't approve of the project's selection of database software/vendor? I've seen this behavior before; a developer refuses to work with the database, so his act of "rebellion" is basically doing the database's job on the app side.

    It's sad, really. Sad, and funny.

  • Some Wonk (unregistered)

    In recognition of the developer saving the company thousands of dollars in lost productivity, Management has graciously approved the award of verbal praise for the developer.

    Next item on the agenda: How to solve the persistent morale problem in the IT department. Should we just fire the unhappy ones?

  • (cs) in reply to Timmorn
    Timmorn:
    Anonymous:
    Holy crap, it's like a taco inside a taco inside a Taco Bell inside a KFC in a mall in your dream!
    ... in a dream.

    You need to go deeper!

    It's already 14 layers deep. We go any deeper, and the report will take an eternity to run.

  • (cs)

    What I want to know is how do you make time to refactor code like this? Every job I have worked at has always kept us developers swamped with "new" work and we are never allocated time to go back and fix things as the rule is "There is ALWAYS something to do"

    My current job could do with a fair bit of code cleanup but there is no time allocated. Should I pretend to take longer on other assigned tasks and use that time to refactor some code or develop a proof of concept to demonstrate how some things can be done better than they are currently?

  • (cs) in reply to Some Wonk
    foreach (DataTable aTable in aDs.Tables) { foreach (DataRow aRow in aTable.Rows) {
    I am impressed by anyone with the fortitude to continue past that point. I couldn't.
  • Fat Guy (unregistered)

    I thought this story was going to be about Taco Bell's new 2 burrito value meal, AKA the number 14.

  • anon (unregistered) in reply to boog
    boog:
    Nagesh Kukunoor:
    Did they find the original programmer who wrote that logic?

    CAPTCHA: dolor - This makes me sad.

    I'm pretty sure I strangled him with a penguin before he made it out the door.

    They call that an "exit interview".

  • me (unregistered) in reply to imgx64

    I think it's more likely some kind of shell (sh, bash,...). $BOSS, $DEITY,... it's a recurring "joke" in the linux world.

  • Uncle Al (unregistered) in reply to boog

    Well, since it's established that time scales upwards by a factor of 20 with each level -- at 14 layers deep, you just about do have an eternity to run (an approximate multiplier of 1.6E18).

  • F (unregistered) in reply to Clumsy Kid
    Clumsy Kid:
    Aether:
    That was only after several demonstrations showing that the output was, in fact, correct, because if it's running that fast, how can it actually be doing it right?

    What management would not want proper testing to show them that the end result is still the same?

    One that was willing to employ the cretin who perpetrated the first version, perhaps?

  • Bill's Kid (unregistered)

    This is what happens when a self-taught VB programmer teaches himself SQL.

  • Lockwood (unregistered)

    Yo dawg I heard you liked foreach so I put a foreach in your foreach so you can foreach while you foreach

  • Nagesh Kukunoor (unregistered) in reply to Nagesh Kukunoor
    Nagesh Kukunoor:
    TRWTF is that if he had simply used simple stored procedure, he would have save even more time.

    I did not post this comment. Someone out here is mkaing fun of me.

  • Nagesh Kukunoor (unregistered) in reply to boog
    boog:
    Nagesh Kukunoor:
    Did they find the original programmer who wrote that logic?

    CAPTCHA: dolor - This makes me sad.

    I'm pretty sure I strangled him with a penguin before he made it out the door.

    Did he sue you afterwards?

    CAPTCHA: populus - the state of my state.

  • Nagesh Kukunoor (unregistered) in reply to Nagesh Kukunoor
    Nagesh Kukunoor:
    Nagesh Kukunoor:
    TRWTF is that if he had simply used simple stored procedure, he would have save even more time.

    I did not post this comment. Someone out here is mkaing fun of me.

    I did not here either. Must be another with same surname?

  • Power Troll (unregistered) in reply to Nagesh Kukunoor
    Nagesh Kukunoor:
    boog:
    Nagesh Kukunoor:
    Did they find the original programmer who wrote that logic?

    CAPTCHA: dolor - This makes me sad.

    I'm pretty sure I strangled him with a penguin before he made it out the door.

    Did he sue you afterwards?

    CAPTCHA: populus - the state of my state.

    Fake frits just can't help himself: he invented yet another altar-ego.

  • Spivonious (unregistered) in reply to boog
    boog:
    Timmorn:
    Anonymous:
    Holy crap, it's like a taco inside a taco inside a Taco Bell inside a KFC in a mall in your dream!
    ... in a dream.

    You need to go deeper!

    It's already 14 layers deep. We go any deeper, and the report will take an eternity to run.

    Maybe the original programmer had just seen Inception and was trying to reach Limbo.

  • Safely anonymous (unregistered) in reply to Ken B.
    Ken B.:
    TRWTF is that you think we'd believe that management would do such a thing.

    Nah, it happens. (It helps if the previous programmer isn't around anymore, though.)

    ObiWayneKenobi:
    What I want to know is how do you make time to refactor code like this? Every job I have worked at has always kept us developers swamped with "new" work and we are never allocated time to go back and fix things as the rule is "There is ALWAYS something to do"

    The trick is to make the fix the "new work". Get the people who use that report to send a request up the line asking if there's any way to make the report run faster. Get them to mention how much time/money/hassle they will save if the report was better. Cc liberally.

  • boog (unregistered)
    Nagesh Kukunoor (unregistered):
    2011-01-31 11:10
    Nagesh Kukunoor (unregistered):
    Nagesh Kukunoor (unregistered):
    TRWTF is that if he had simply used simple stored procedure, he would have save even more time.
    I did not post this comment. Someone out here is mkaing fun of me.
    

    I did not here either. Must be another with same surname?

    Power Troll (unregistered):
    2011-01-31 11:11
    Nagesh Kukunoor (unregistered):
    boog (unregistered):
    Nagesh Kukunoor (unregistered):
    Did they find the original programmer who wrote that logic?
        I'm pretty sure I strangled him with a penguin before he made it out the door.
    
    Did he sue you afterwards?

    Fake frits just can't help himself: he invented yet another altar-ego.

    1-minute difference...same guy?

  • (cs) in reply to imgx64
    imgx64:
    This is either Perl (which I don't know much about) or PHP (which I used before it got all this fancy OO stuff). Either way, I don't think the second $BOSS should have $, but I could be wrong.
    It isn't valid Perl. Surprisingly, the second $BOSS is legal there, if $BOSS happens to be an object which stringises to a method that it has (e.g. strings aren't objects in Perl, but if they were, after 'my $BOSS = String->new("ucfirst");' you could do '$BOSS->$BOSS' and get "Ucfirst", although you'd need strict "refs" off to be allowed to even contemplate such a monstrosity); but the square brackets at the end are inconsistent with the syntax beforehand. It should either be "${$BOSS->$BOSS->Offspring}[1]", or the abbreviation "$BOSS->$BOSS->Offspring->[1]" in order to avoid a syntax error, and even then, you'd need a ridiculously contrived program for it to not just error out when executed, as well as turning strict mode off.

    I'm not sure about PHP, although it's generally less tolerant of interpreting a random string of characters as a program than Perl is, so I suspect it's invalid in PHP too.

  • Meme Responder (unregistered) in reply to boog
    boog:
    Nagesh Kukunoor (unregistered):
    2011-01-31 11:10
    Nagesh Kukunoor (unregistered):
    Nagesh Kukunoor (unregistered):
    TRWTF is that if he had simply used simple stored procedure, he would have save even more time.
    I did not post this comment. Someone out here is mkaing fun of me.
    

    I did not here either. Must be another with same surname?

    Power Troll (unregistered):
    2011-01-31 11:11
    Nagesh Kukunoor (unregistered):
    boog (unregistered):
    Nagesh Kukunoor (unregistered):
    Did they find the original programmer who wrote that logic?
        I'm pretty sure I strangled him with a penguin before he made it out the door.
    
    Did he sue you afterwards?

    Fake frits just can't help himself: he invented yet another altar-ego.

    1-minute difference...same guy?

    This comment is 14 inches deep!

Leave a comment on “14 Layers Deep”

Log In or post as a guest

Replying to comment #:

« Return to Article