- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
So... what makes you think there isn't a reason why it's called "code"?
Admin
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!
Admin
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....
Admin
So if there's only one gentleman here, are you calling everyone else ladies? I think they might be insulted.
Admin
ndvwls
Admin
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..
Admin
Admin
Nah, he's just implying that the rest of us don't own any realestate.
Admin
Admin
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.
Admin
Dammit! They stole the code for my oscillation overthruster!
Admin
tl;dr!
Admin
Admin
Clearly, and particularly as an American, you are aware that the lack of punctuation is pointless.
Also commaless, quotefree and uninfected by bangs.
Admin
A lot of people in IT seem to have that problem.
Admin
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?)
Admin
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.
Admin
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"
Admin
/me nods
Admin
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"
Admin
Yes, the WTF here is clear, they should be using SET statments, not SELECT statements to carry out non-set based operations.
Admin
The use of uplift in that context was the best thing I've read in 48 hours.
c.f. The Uplift War, David Brin
Admin
Why does everyone pick on Granma?
Admin
I was tinking that.....
Gold, Pure Gold!!!!
Admin
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.
Admin
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 :)
Admin
Definitely enough l_sd.
Admin
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)
Admin
Admin
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.
Admin
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.
Admin
Admin
Creative ASCII art.
Admin
Actually, longer variable names don't always help. I once encountered "void ThrowUpSomeData(CurrentDataPuddle *Data)" That one was definitely a classic.
Admin
Hey, try to understand the code, it'll lead you out of the Matrix!
Admin
Admin
I actually felt sharp pain in my chest when I saw this.
Admin
Actually, if you replace every fourth 'SELECT' with 'PLEASE DO' and the rest of them with 'DO', you get an INTERCAL version of Tetris.
Admin
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.