- 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 is the WTF here?
Do you have a problem with IF ELSE statements?
Does it bother you that the IF part is the same as the ELSE part?
Obviously the code used to do something different depending on the value of Request.QueryString("source_url"). The requirements later dictated that the same operation be performed in both circumstances. The programmer, when making that change, didn't want to cause any unwanted side-effects that might be caused by removing the branch. The sensible and logical thing to do, in that case, is to simply give both branches the exact same code.
Admin
Just planning ahead, right? [8-|]
Admin
You are obviously joking or you are an idiot
If it's the former, this sense of humor really isn't that funny.
Admin
Perhaps you could elaborate on "unwanted side-effects that might be caused by removing the branch". Try as I might, I can't figure out what could go wrong by simply removing the IF ELSE.
Admin
Or maybe my sarcasm detector is irreparably damaged from all the actual moronic posts... let's hope that's the case.
Admin
Nice, you take the high road, I'll take the low road....hey we got to the same spot either way! Jeeeez...
Admin
Maybe there was a problem regarding a cache-flush that only occured when an if-then-else statement were in that exact point. But, the more likely case is it as paid by number of lines.
Admin
LOL
Admin
What Matt B said. The only thing that could be causing a side effect is the Request.QueryString("source_url") call. If this is an issue, then the call should be made outside the if clause and the branch should still be removed. There is absolutely no sense in maintaining two copies of the same code when one will do.
- B
Admin
Wow.... I was struck speechless for at least a minute there.
Wonder if this consultant ever thought of nesting these beasts inside one another? [:^)]
Admin
So, basically you took time out to say one of two things to me:
A) You are an idiot.
-or-
B) You aren't funny.
Why be so negative?
This is a place that people are supposed to come to make fun of others not each other!
Admin
Do programmers actually get paid by the line? (cringe...Waits for flame thrower to hit) I have never actually programmed outside of work before. I can't see where that would be a good way to do business, on the other hand it could be very profitable...
Admin
I laughed.
Admin
It would be profitable for the programmer, but not for the employer. For the 'by the line' approach to be anything near useful for an employer, the employer would also have to do code reviews to make sure the programmer isn't doing the kind of donkey doo we see here. But, if you are going to do code reviews, then you can just pay based on merit according to the code reviews.
I doubt many people, (if any at all) have or do get paid by the line. I wouldn't be surprised if in the past employers used to base an employees productivity by numbers of lines, but I would hope that most employers have wised up by now and use better methods of determing productivity and program quality.
Admin
http://www.dba-oracle.com/dress_code.htm - Is this a joke? I don't know anyone who would be willing to live by that dress code. And hello, "All ear hair must be shaved"? Yikes.
Admin
This is called Best Practices and eXtreme Programming, people: TEST EARLY (first <FONT face="Courier New">if</FONT>...) and TEST OFTEN (<FONT face="Courier New">else</FONT> block).
Admin
I submitted that WTF and I can tell you that it is based on real code I have been given to maintain, and that the consultant in question was a "professional" VB coder paid by project not by lines of code (does anybody?).
Plus, this was production code, and the consultant no longer maintains it, so I can asure you that it wasn't an attempt to avoid side-effects while testing, but more likely what I call "Copy Paste Syndrome", or the (incredibly common) "DeMorgan Mutation Disorder", where someone tries to refactor the logic of conditional branching in an attempt to simplify it, and ends up with a disastrous monster that just happens to branch as intended, mostly. :)
-dZ.
Admin
You must be new to this planet...and when are the pancakes coming?
Admin
Actually, there's a third possibility: He wrote the code and was paid by the line.
Admin
<font class="bodyTextMedium">Donald K. Burleson
</font><font class="bodyTextMedium">Man this dude looks like an Umpa-Lumpa!
</font>
Admin
Heck yeah! I'd be coding myself up a Lexus! [:D]
Admin
Well, now you can begin all over
Admin
Am I the only one who looks at "&verify=1" and gets an ominous feeling? I hope that's not a flag put in the URL query string to perform some sort of security or input verification, because if it is, the user could theoretically replace it with "&verify=0" to do an end run around the measures in place.
The query string will be visible by the user in their address bar since a response.redirect is being perfomed instead of a server.transfer. Maybe I'm just paranoid.
Admin
Hah! You think that's bad, try entire parallel methods! It's sad, but I've seen it. On a related note, is it physically possible to read this many books on Oracle much less write them? And the wife? With the minature horses?
All in all, that leaves me more speechless than the actual WTF.
Admin
Brilliant.
Admin
> People can spot a cheap suit at 300 yards, and so can our clients.
I like how this implies that their clients are not people.
Admin
The End if would get lonely. [:'(]
Admin
If lawyers get paid by the hour and writers and reporters get paid by the word, why couldn't programmers get paid by the line?
Admin
You aren't thinking deeply enough, this is a highly paid consulant that obviously used complex multi threading in his code, in the case, the evaluation of the IF undoubtly solved some syncronization problem. Doing it any other way is Wrong ;)
Admin
Imagine all of the loop unrolling that would take place...for performance optimization, of course [:P]
Admin
When I last saw the dress code, it wasn't nearly as elaborate, and had no illustrations. Back then, it looked almost legit.
Admin
And this statement is a good example of what is wrong with the world. People don't get paid for doing good work, they get paid for doing what looks like much work.
The best code I produce, usually take less amount of lines. The more lines the code have, the longer it takes to read it, the greater the chance that there is a bug hidden in it, and the greater the chance that there is duplicated code in it.
Admin
Seconded. A much more efficient model would be to pay programmers by the number of times their code executed and did what it was supposed to, minus the number of times their code executed and failed with an error, minus five times the number of times their code executed and failed silently (possibly staggering along long enough to corrupt data.)
Admin
Can someone tell me WTF is up with the images on this page? Are they supposed to be Don and the wife or what?
http://www.dba-oracle.com/art_fun_starwars_movie.htm
Admin
Now that's irony - the guy with the rigid, "professional", "females can NEVER wear anything but skirts" website posts photoshopped pictures of himself on said website.
Admin
I refactor that to:
Response.Redirect strRedirect & "&verify=1&process=1"
In ASP the parens are optional and mostly annoying. Of course, my code (as the original WTF) assumes that strRedirect already has some querystring, otherwise we need to kill the leading "&".
Frankly, after spending a lot of time refactoring ASP code, in a corporate IT shop, this is small stuff. Hardly worth talking about.
My favorite is when they take every field from an Oracle database and append an empty tring to it so they don't have to deal with NULL.
It ends up looking like:
var1 = rs("field1") & ""
var2 = rs("field2") & ""
var3 = rs("field3") & ""
I ran into a lot of that from my old job.
Admin
There is the possibility that this could be the result of an automated refactoring tool, though even then it's hard to think of a case where this would result unless the automated refactoring tool is badly used.
Admin
As Edsger Dijkstra put it, one should not measure lines of code produced by a programmer, but lines of code spent.
Admin
Actually, I've seen that and there is a reason. Due to some wierd bug in ADO, you sometimes get intermittent errors if you don't do that. For some reason, it is not the null values that screw things up, it is usually if there are several long strings in one record, and adding a nonsense empty string for some wierd reason fixes it. It is one of those really wierd Heisenbugs that don't appear when you singlestep through the code, just when it is run normally.
So, that sure is a WTF, but the WTF is in ADO.
Back to the WTF at hand. I suspect this is just test code put in before real data is available, and before that happened, the programmer moved on to other tasks and it was forgotten and never changed to the real values. Wrong, but something that happens to us all occasionally. He should have put a TODO-comment there...
Admin
Anyone else think that a dinosaur is a little bit of an inappropriate logo for a forward thinking 'world class' consulting company?
Oh, I get it, they're making a subtle reference to Oracle's relevance to the modern world........
Admin
I get an ominous feeling too, because it should read "&verify=1". It says so somewhere in the URL RFC. Luckily browsers will eat "&verify=1" as if it was correct.
Drak
Admin
Ahh... Finally code generators are starting to pay off...
I think this would also explain the great pyramids of DIV
Admin
Actually, it would explain most of the WTF's here, they're not bad programmers, they're good consultants forced to write this type of code by their evil management.
Admin
I get paid like that. That's why I don't use VB, because you can't put all code on 1 line.
Admin
I most definitely beg to differ. I've had to maintain code from very incompetent consultants. Some of them may have been genuinely stupid, but most of them is just that they don't care enough to do things the Right Way, or to even learn beyond code that merely somehow works.
-dZ.
Admin
I believe you can put it in one line. I think you use colon ':' to separate the commands, just like you would use a semi-colon ';' in other languages. Don't forget the "BASIC" in the "VisuaBasic" :)
dZ.
Admin
OOh, Don't get me started on the incompetent consultant bandwagon. Case in point:
I used to work for a small company, and eventually received a better offer in the games industry, naturally, like an idiot, I took it. The company, trying to get the product I started to production hired a highly paid consultant. I got sick of the gaming world, and came back to the company I worked for. My code seemed to have morphed into some tangle of WTFs. The product was never released and the company tanked.
Why? The consultant allowed his own arrogance seep into the code. Most of the stuff I had working, and working well was completely hosed. It took many months to get the program up and running again before the company finally went under.
Admin
You're right, I remember again... argh... it's all coming back to me... just thought I got rid of the VB bad trip flashbacks ;-)
Admin
Only if you're Response.Write(...)ing it. If you're Response.Redirect(...)ing, then it should be & and not &
Try it and see.
Admin
The sad thing is that ... er... I never got rid of them, and forever was cursed to retain that "knowledge". :(
dZ.