• (cs)

    So... what makes you think there isn't a reason why it's called "code"?

  • Zach Bora (unregistered)

    This looks perfect to me, looks easy to modify, compared to what I have to do where I work at.

    HELP ME GET OUT OF HERE!

  • Jonathan (unregistered)

    OK, now, who saw that and tried to find the pattern to simplify it?

    Anyone? You there in the back?

    Yeah, ok, I did too....

  • (cs) in reply to sammy baby
    sammy baby:
    It's definitely machine generated. Ladies and gentleman, we have a functioning example of artificial stupidity.

    Addendum (2009-04-15 09:31):

    gentleman

    And a functioning example of what a natural lack of sleep does to my ability to spell. Doh.

    So if there's only one gentleman here, are you calling everyone else ladies? I think they might be insulted.

  • Azeltir (unregistered) in reply to Spectre
    Spectre:
    Code Dependent:
    Anonymous:
    Grammars pointless
    sos punctuation
    sorespaces

    ndvwls

  • Glow-in-the-dark (unregistered) in reply to Beldar the Phantom Replier
    Beldar the Phantom Replier:
    Or are we looking at the SQL implementation of Rijndael?
    Given the way it's defenestrated I think it's more AES, the stripped down version of Rijndael..

    Alternative theory: it's a stored tarpit, made to look like Rijndael so people spend their time trying to decrypt it when in reality it really is as it looks: total garbage..

  • Glow-in-the-dark (unregistered) in reply to notromda
    notromda:
    sammy baby:
    It's definitely machine generated. Ladies and gentleman, we have a functioning example of artificial stupidity.

    Addendum (2009-04-15 09:31):

    gentleman

    And a functioning example of what a natural lack of sleep does to my ability to spell. Doh.

    So if there's only one gentleman here, are you calling everyone else ladies? I think they might be insulted.

    I have no idea what the average coder does in his spare time so I decline judgement.. :-)

  • Lego (unregistered) in reply to notromda
    notromda:
    sammy baby:
    It's definitely machine generated. Ladies and gentleman, we have a functioning example of artificial stupidity.

    Addendum (2009-04-15 09:31):

    gentleman

    And a functioning example of what a natural lack of sleep does to my ability to spell. Doh.

    So if there's only one gentleman here, are you calling everyone else ladies? I think they might be insulted.

    Nah, he's just implying that the rest of us don't own any realestate.

  • (cs) in reply to Azeltir
    Azeltir:
    Spectre:
    Code Dependent:
    Anonymous:
    Grammars pointless
    sos punctuation
    sorespaces

    ndvwls

  • (cs)

    If you thing this is bad, then how would you write it? Looks perfectly clear to me, though Lord knows it could do with some comments to say what it's trying to do. I guess if you find it hard to read, then you're just not used to SQL.

  • Dr. Buckaroo Banzai (unregistered)

    Dammit! They stole the code for my oscillation overthruster!

  • Addison (unregistered)

    tl;dr!

  • (cs) in reply to Yanman
    Yanman:
    Can anyone even explain what it does?
    It is a common equation used in the financial industry for calculating the gross securitized prenatal growth rate of optionally indentured hedge bond futures.
  • (cs) in reply to Code Dependent
    Code Dependent:
    Anonymous:
    Grammars pointless
    sos punctuation
    It's rather like that common misquote from 1 Timothy 6:10, isn't it? People forget to preface "Money is the root of all evil" with "The love of..."

    Clearly, and particularly as an American, you are aware that the lack of punctuation is pointless.

    Also commaless, quotefree and uninfected by bangs.

  • (cs) in reply to pink_fairy
    pink_fairy:
    ...and uninfected by bangs.

    A lot of people in IT seem to have that problem.

  • überRegenbogen (unregistered)

    Without knowing what it does (or even much about SQL), at a glance i'd say that it could at least be optimised by putting all those redundant calculations in some scratch variables. It is, after all, faster to fetch a value from a variable than to fetch a value from a variable and do math on it—no matter what language you're using. It'd be more compact, too.

    [Captcha="immitto". New Taco Bell product?)

  • morry (unregistered)

    thank GOD you pulled it out of that decaying, archaic, unreadable unmaintainable legacy system and modernized it into this clearly understandable and even dare-i-say-it helpful SQL stored procedure! Truly progress has been achived.

    /p.s. sarcasm. i used it.

  • (cs) in reply to Grammar Nazi
    Grammar Nazi:
    I can't stand it anymore! whomever is responsible is as bad as between you and I.

    The rules are not that hard. For subjects, use "I" and "whoever". For objects, use "me" and "whomever". The key is to identify the clause of which the pronoun is the subject or object.

    The grenade bounced between her and me. She and I wondered which of us was meant to be the target. I wanted to throw it back at whoever tossed it. Whomever he was trying to hit would have been blown to bits had the grenade-tosser hit his mark.

    Alternatively, the 'easy' way to work it out is to remove the words about the other person/people and see if it still sounds right:

    "The grenade bounced between I." WRONG! "The grenade bounced between me." RIGHT -> so "her and me".

    "Me wondered which of us was meant to be the target." WRONG! "I wondered which of us was meant to be the target." RIGHT -> so "She and I"

  • stiggy (unregistered) in reply to mxsscott
    mxsscott:
    Grammar Nazi:
    I can't stand it anymore! whomever is responsible is as bad as between you and I.

    The rules are not that hard. For subjects, use "I" and "whoever". For objects, use "me" and "whomever". The key is to identify the clause of which the pronoun is the subject or object.

    The grenade bounced between her and me. She and I wondered which of us was meant to be the target. I wanted to throw it back at whoever tossed it. Whomever he was trying to hit would have been blown to bits had the grenade-tosser hit his mark.

    Alternatively, the 'easy' way to work it out is to remove the words about the other person/people and see if it still sounds right:

    "The grenade bounced between I." WRONG! "The grenade bounced between me." RIGHT -> so "her and me".

    "Me wondered which of us was meant to be the target." WRONG! "I wondered which of us was meant to be the target." RIGHT -> so "She and I"

    /me nods

  • alright then son (unregistered) in reply to mxsscott
    mxsscott:
    Grammar Nazi:
    I can't stand it anymore! whomever is responsible is as bad as between you and I.

    The rules are not that hard. For subjects, use "I" and "whoever". For objects, use "me" and "whomever". The key is to identify the clause of which the pronoun is the subject or object.

    The grenade bounced between her and me. She and I wondered which of us was meant to be the target. I wanted to throw it back at whoever tossed it. Whomever he was trying to hit would have been blown to bits had the grenade-tosser hit his mark.

    Alternatively, the 'easy' way to work it out is to remove the words about the other person/people and see if it still sounds right:

    "The grenade bounced between I." WRONG! "The grenade bounced between me." RIGHT -> so "her and me".

    "Me wondered which of us was meant to be the target." WRONG! "I wondered which of us was meant to be the target." RIGHT -> so "She and I"

    or use words which mean it doesn't matter:

    "The grenade bounced between us" "We wondered which of us was meant to be the target" "I wanted to throw it back at that cunt wot tossed it" "We'd have been fucked if that grenade hit us, yo"

  • Grassfire (unregistered)

    Yes, the WTF here is clear, they should be using SET statments, not SELECT statements to carry out non-set based operations.

  • (cs) in reply to Dennis
    Dennis:
    That's the strangest use of the word "uplifting" I've ever seen.

    The use of uplift in that context was the best thing I've read in 48 hours.

    c.f. The Uplift War, David Brin

  • Grandson (unregistered) in reply to Anonymous
    Anonymous:
    Grammars pointless

    Why does everyone pick on Granma?

  • Milton (unregistered) in reply to alright then son
    alright then son:
    mxsscott:
    Grammar Nazi:
    I can't stand it anymore! whomever is responsible is as bad as between you and I.

    The rules are not that hard. For subjects, use "I" and "whoever". For objects, use "me" and "whomever". The key is to identify the clause of which the pronoun is the subject or object.

    The grenade bounced between her and me. She and I wondered which of us was meant to be the target. I wanted to throw it back at whoever tossed it. Whomever he was trying to hit would have been blown to bits had the grenade-tosser hit his mark.

    Alternatively, the 'easy' way to work it out is to remove the words about the other person/people and see if it still sounds right:

    "The grenade bounced between I." WRONG! "The grenade bounced between me." RIGHT -> so "her and me".

    "Me wondered which of us was meant to be the target." WRONG! "I wondered which of us was meant to be the target." RIGHT -> so "She and I"

    or use words which mean it doesn't matter:

    "The grenade bounced between us" "We wondered which of us was meant to be the target"

    I was tinking that.....

    alright then son:
    "I wanted to throw it back at that cunt wot tossed it" "We'd have been fucked if that grenade hit us, yo"

    Gold, Pure Gold!!!!

  • Utunga (unregistered) in reply to Code Dependent
    Code Dependent:
    Utunga:
    I'm responsible of writing a database view that takes about twenty pages to print out (if you leave out the comments) and whose sole purpose in life is to determine whether a user is allowed to access another user's data.
    My team uses Active Directory group membership for that.

    That would possibly work if it weren't for a few problems;

    a) not nearly all our clients have any sort of AD set up - other than our system, that is. And b) if the business rules were not of the type "in case the current user is a doctor/nurse/etc. and the person s/he wants to see is one that either has medical examination done during last x months and/or is scheduled for medical examination in the next x months and/or has been sent in by a doctor of another branch who has the necessary clearance to send people to see other branch medical teams and ..." - handling this with active directory would be a much bigger mess than it is at present.

  • Frank (unregistered)

    Hm, interesting. There's tv's missing (105-108, 110, ...). I guess that is so there's room for future "developments".

    Other than that, I don't really see the WTF. The visual improvement by replacing the repeated arithmetics with variables is minimal (I tried), the speed improvement is not very large either (in a compiled language, the compiler would probably do it anyway).

    And at least I do not see a method to simplify the calculation. There does not seem to be a structure to it, so...

    I have written some Runge-Kutta-Fehlberg algorithms that look similar (using coefficient matrices at least, but their initialization does look as strange as the example here.). Sometimes, there is no elegant solution.

    But if you have one, please tell me :)

  • pm (unregistered)

    Definitely enough l_sd.

  • Moz (unregistered)

    I think the problem is more that they're using the wrong domain-specific language. Even a stats pack for the system would be a help, if they can't just use matlab (or fortran)

  • how now brown (unregistered)
  • Shinobu (unregistered)

    At first glance, I thought it could be machine generated, but when looking at the code more closely I think I've found a more likely hypothesis. These all looks like subscripts and prefactors to me, so this is probably a set of mathematical formulae which are probably completely obvious to anyone with a basic understanding of the subject matter. Perhaps there should have been a book reference in there as a comment, but otherwise the code is perfectly okay. Imagine the same code with longer descriptive variable names. That would most certainly not be clearer because it becomes hard to oversee the formula as a whole and check it against the source. And the constants probably are just the prefactors from the formulae, the only thing you could replace them with are Prefactor1, etc. Not good. So no, apart from a missing comment on the source of the formulae (which may have been there somewhere originally, after all this is an excerpt) this is most definitely not a WTF.

  • (cs)

    Third, I hope either there are some very good comments documenting exactly what this does, why it does it, and why it looks like such shit, or the guy who wrote it was canned.

  • (cs) in reply to Andrew 'The Turk' Goode
    Andrew 'The Turk' Goode:
    Don't run this SQL, I saw something similar when I was a summer intern at Cyberdyne Systems Corporation.
    I think I saw you DIE yesterday... Yes I did in my SCC-session. So Andrew could you please explain?
  • (cs)

    Creative ASCII art.

  • Mjolnir (unregistered)

    Actually, longer variable names don't always help. I once encountered "void ThrowUpSomeData(CurrentDataPuddle *Data)" That one was definitely a classic.

  • mrmermaid (unregistered)

    Hey, try to understand the code, it'll lead you out of the Matrix!

  • less fairy (unregistered) in reply to snoofle
    snoofle:
    But, but, none of the tv_nnn variables are ever read after assignment... assuming there's not something after what's shown that uses them, just no-op the whole thing!
    But all the cool kids add side effects to access handlers.
  • (cs)

    I actually felt sharp pain in my chest when I saw this.

  • (cs)

    Actually, if you replace every fourth 'SELECT' with 'PLEASE DO' and the rest of them with 'DO', you get an INTERCAL version of Tetris.

  • A Programmer (unregistered)

    Probably not a WTF. It looks to me like an SQL implementation of a statistical model for survey data. They're extremely complex mathematical formulas that would indeed be incomprehensible to someone unfamiliar with what's going on.

    The truth is that it would have been copied out of a paper, using the variable names from the paper, because the guy doing the copying doesn't have PhD in statistics, and therefore cannot hope to understand what's actually going on.

Leave a comment on “Well, at least it compiles...”

Log In or post as a guest

Replying to comment #:

« Return to Article