- 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
That's because there are only 4 lights.
Admin
He's making a list, and checking it twice...
Didn't your mother tell you, if it is important, you should always double check?
He's just trying to write fault-tolerant code for an embedded system. Not a WTF. And he's paid by the line. And it's just in dev anyway, as others mentioned.
Maybe TDWTF is the victim of its own success. We've shamed all the crappy programmers out of the profession. Stupid mistakes aren't being made any more. And I have this great app for managing the Brooklyn Bridge to sell you.
But I, too, have submitted worthy (IMHO) WTFs and had them ignored. So, it's off to the sidebar, or maybe failblog or something...
Admin
TRWTF is breaking in both the if and else instead of at the end of the case... :-X
But no, break does not break out of if blocks in JavaScript, ... Fucking trolls.
Admin
Wrong. It is asynchronous, but no browser runs Javascript from the same page in more than one thread.
That doesn't make sense, because the first three checks are irrelevant, and the fourth can't change - if the response has finished receiving, what would it change to?This is just poor code.
Admin
After being ruled by English for several decades, I decided to get back at them by slaughtering their language. Call me Daniel Webster of Hyderabad.
Admin
Please stop using my name.
Admin
You have never seen a progress meter or wait graphic displayed during an AJAX call? As soon as it hits state 1 you want to disable whatever control caused the call to reduce redundant requests.
Admin
Oh well. Your English is probably better than my Urdu anyway.
Admin
That's why it's always better to use GOTO instead of break, continue, etc; especially in JavaScript..
Admin
The programmer explicitly checks for and discards all the possible statuses? And this isn't a wtf? Wtf is wrong with you people? TRWTF is you points /Kitchener
The other oddities are just the sugar sprinkled on top.
Admin
No one else thought that the original developer might have been trying to increase his SLOC?
Admin
A little worried? There must be millions of people who haven't even read it yet.
Admin
Admin
A lot of people in Hyderabad speak it, but I don't. Hindi is sufficient for communication.
Admin
You want your butt kicked?
Admin
To me, this looks like the code was originally like this:
and a new programmer was told "change this to use switch/case instead".
Admin
Seriously though, would you stop using my fucking name already? It's not big and it's not clever. Don't you have enough of an identity to use your own name? Are you some kind of schizo? You know what, I don't care; just grow up already, this is supposed to be a community of professionals and your behaviour is letting everyone down.
Admin
So the WTF is that the guy thought he might need to respond to other ready states and failed to put in a //TODO ?
Addendum (2011-02-02 13:40): Nevermind - just noticed the ifs. This is the kind of retard that would fuck up a foreach.
Admin
Admin
This is some serious double protection! I wonder if anyone told them wearing two condoms does NOT mean safer sex...
Admin
httpRequest: "I have altered the state, pray that I do not alter it any further"
Admin
Of course TRWTF is thinking that this place is supposed to be a community of professionals.
Admin
He's just future-proofing his code. If they decide to make readystate==3 do something, bam, he has a place to do that.
Admin
Both of you, if you're gonna use my name, can you at least not anglicize it? k thx bye
Admin
Askimet.... Ahhh.... wasted 10min of my valuable time on participating on this stupid post.... there you go: my personal wtf of the day!
Admin
I guess I've made it - I've got my own imposter. Time for a handle refresh.
Admin
Several people mentioned that already, but I share their ideas:
So TRWTF is JS : a difficult functional language, that teenages try to use to grow from imperative spaggetti script kiddies to Object Oriented programming, which obviously must fail.
My theory: there would be less script kiddies if JS actually was multithreaded, as none of them could ever write a onmousemove handler correctly
Admin
Admin
If it was so difficult for you, you should have just gone to PHP like everyone else.
Admin
In IT, you often have to choose between Competent and Professional. Which do you prefer?
Admin
Since this only realy makes sure, it's fine. Now if it really made sure, that'd be a different story.
Admin
I'm totally not surprised though.
Admin
Seriously? Go back to school, right now. Quit your job, don't do any coding, until you learn the answer to that question.
Admin
Neither. I'll take cheap.
Admin
Admin
No, the real wtf here is that there is a page and a half of comments before someone mentioned the word 'lock'
Admin
Admin
Yeah, something happened around here where the serious coder:troll ratio went way down hill.
Admin
Ready? Set? Ready? Set? GO!
Everyone who didn't wait is disqualified.
Admin
Admin
Admin
Methinks the author had his brain switched off.
Admin
TRWTF are incompetent morons writing CodeSOD comments. Include me if you wish, but whatever.
Admin
TRWTF is these comments. I really can't tell if most of them are supposed to be funny, trolling, or just really bad programmers demonstrating their crappiness.
If you need to do multiple operations based on the value of status at some point, and status can change, then you copy it's value to a local variable first and then do all operations using that variable, not the function. Congrats, your code is now immune to dozens of strange things that might happen if it changes mid run. No locking, no "framework" wtf ever that meant, no worries about threads, events, synchronization, garbage collection, fifth normal form and god knows whatever else has clouded the brains of the people posting here.
Admin
Admin
just because you're paranoid, don't mean javascript ain't after you
Admin
Option 3: they are the same person
Admin
TRRWTF is that you american communist haven't read the comments properly and base a fragile argumentation on top of your fragmented observations:
Go fuck yourself, pothead.
Admin
perhaps is not a WTF because the programmer thought that, in the future, some logic will be included in the others cases of the swicth statement
Admin
So how shall I implement that directive?