| « Prev | Page 1 | Page 2 | Next » |
|
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. |
|
Just planning ahead, right? [8-|]
|
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:22
•
by
Matt B
|
You are obviously joking or you are an idiot If it's the former, this sense of humor really isn't that funny. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:23
•
by
cdog
|
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:26
•
by
cdog
|
|
Or maybe my sarcasm detector is irreparably damaged from all the actual moronic posts... let's hope that's the case.
|
|
Nice, you take the high road, I'll take the low road....hey we got to the same spot either way! Jeeeez...
|
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:27
•
by
Mike R
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:29
•
by
curtisk
|
LOL |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:32
•
by
Brad
|
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 |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:35
•
by
OneFactor
|
|
Wow.... I was struck speechless for at least a minute there. Wonder if this consultant ever thought of nesting these beasts inside one another? [:^)] |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:44
•
by
whoisfred
|
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! |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:46
•
by
cm5400
|
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... |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 14:51
•
by
Rick
|
I laughed. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 15:10
•
by
whoisfred
|
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. |
|
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. |
|
This is called Best Practices and eXtreme Programming, people: TEST EARLY (first if...) and TEST OFTEN (else block). |
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 15:25
•
by
Bustaz Kool
|
You must be new to this planet...and when are the pancakes coming? |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 15:54
•
by
Craig Stuntz
|
Actually, there's a third possibility: He wrote the code and was paid by the line. |
|
Donald K. Burleson
Man this dude looks like an Umpa-Lumpa! |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 16:03
•
by
Otto
|
Heck yeah! I'd be coding myself up a Lexus! [:D] |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 16:30
•
by
cm5400' Boss
|
|
Well, now you can begin all over
|
|
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.
|
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 16:54
•
by
ces
|
|
Brilliant.
|
|
> 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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 17:09
•
by
MikeB
|
The End if would get lonely. [:'(] |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 17:19
•
by
bobday
|
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? |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 17:47
•
by
Ayende Rahien
|
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 ;) |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 17:59
•
by
pjabbott
|
Imagine all of the loop unrolling that would take place...for performance optimization, of course [:P]
|
|
When I last saw the dress code, it wasn't nearly as elaborate, and had
no illustrations. Back then, it looked almost legit. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 18:05
•
by
wildclaw
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 18:20
•
by
Maurits
|
|
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.) |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 19:07
•
by
Anonymous
|
|
Can someone tell me WTF is up with the images on this page? Are they supposed to be Don and the wife or what? |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-25 20:27
•
by
Matt B
|
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. |
|
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. |
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 02:38
•
by
Z
|
As Edsger Dijkstra put it, one should not measure lines of code produced by a programmer, but lines of code spent. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 04:04
•
by
Raw
|
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... |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 04:13
•
by
Spidey
|
|
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........ |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 04:28
•
by
Drak
|
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 |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 04:43
•
by
wtijsma
|
Ahh... Finally code generators are starting to pay off... I think this would also explain the great pyramids of DIV |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 04:45
•
by
wtijsma
|
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 05:01
•
by
wtijsma
|
I get paid like that. That's why I don't use VB, because you can't put all code on 1 line. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 06:28
•
by
DZ-Jay
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 06:31
•
by
DZ-Jay
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 07:47
•
by
Mike R
|
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. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 08:03
•
by
wtijsma
|
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 ;-) |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 08:52
•
by
Paul
|
|
Only if you're Response.Write(...)ing it. If you're Response.Redirect(...)ing, then it should be & and not & Try it and see. |
Re: Damned IF You Do, Damned ELSE You Don't
2005-05-26 09:13
•
by
DZ-Jay
|
The sad thing is that ... er... I never got rid of them, and forever was cursed to retain that "knowledge". :( dZ. |
| « Prev | Page 1 | Page 2 | Next » |