- 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
first
Admin
Booleans are hard!
Admin
<font size="2">Because you never know when TRUE might equal FALSE...
Hope be with ye,
Cyan
</font>
Admin
Pshh, that doesn't even do tribool. What crap.
Admin
An excellent example of defensive programming. You'll all be sorry you mocked it when the next version of the CLR adds "maybe" and "sometimes" to the list of possible values for a bool.
Fools!
Admin
Let's see.... true, false, maybe, possibly, should-be .... there must be a thousand other cases that we could test for ... maybe the language spec for a primitive will change -- who knows.
Admin
You beat me to it!
Admin
if a boolean isn't true or false, then we have some bigger issues to address, no?
Admin
Wow, think of all the lines of code that could be used to validate that an integer is an integer. Or testing every possible string combination. That's like infinity billion lines!
Admin
Hmm...this quality of this WTF just isn't up to snuff. C'mon Alex, give us some good ones!
Admin
well, if you don't should on me, i won't should on you.
Admin
What about "File Not Found" ?
Admin
No ... Booleans are! or Booleans not are! there is no hard!
Admin
God! That took 13 minutes people! We're slipping!
Admin
Should have been "throw new EndOfUniverseException();"
If you are going to write code that is never going to get executed, it should at least be creative or something...yuck.
Admin
The Daily WTF zings Slashdot; Slashdot takes a shot at Digg. What's next? Digg attacks Fark?
Admin
Validating booleans is scrap, but converting them to strings to validate then (to two different strings each, because of the the uppercase conversion) is even worse.
Admin
The fun part comes when Boolean.ToString() is localized to return true/false strings in the appropriate language, at which point m_ISO9001.ToString().ToUpper() returns "VRAI"/"FAUX" on a computer in France and the program dies horribly.
Admin
bool v_ISO9001 = value;
//can only be true or false
if (v_ISO9001.ToString().ToUpper() == "TRUE" ||
v_ISO9001.ToString().ToUpper() == "FALSE") { m_ISO9001 = v_ISO9001; } else
{
throw new ArgumentException();
}
Wouldn't the [bool v_ISO9001 = value;] part throw an exception if value couldn't be made into a bool type anyways thus making the rest of this code pointless?
Admin
They lost it.
Admin
AH! so the whole point was to make sure that only ENGLISH speaking people can use the software! Very creative security, and curse the french!
Admin
Dumb
This guys ip should be banned
Is this a first form or the daly wtf form?
Admin
But at least this code will catch it if someone tries to pass "hard" instead of "TRUE" or "FALSE"
God, this guys a genious! I wanna be like him when I grow up!
BTW, does anyone else have trouble with the CAPTCHA? I'm colour blind, and most of the time all I see is a pink block :S
Admin
Without bashing the developer, I would really want to know why the developer really felt it was important to go this route. Absolutely, this is "wtf-code", but, someone actually sat down to think this out - I would have to ask myself "why didnt they see the circular logic in using a Bool, casting to a String, and checking the string result in a boolean fashion?"
Something is critically wrong when a developer, who obviously understands the OO principles of Get/Set and constructs of IF..THEN..ELSE plus Casting, yet, writes total bunk like this.
Sure, you can say "well, thats what you get when you outsource stuff", but I dont buy that. I've worked with lots of people from India, Russia, Eastern-Europe, China - they understand and get the concepts of programming just as well as you or me. Something more sinister is at hand - is it "Antagonizing Compliance" between a sour employee and a sour manager? Is it compliance with a tersely worded spec that ridiculously demands "each and every parameter will be checked on entry and exit, in each and every call" [I've seen crap like that].
Or is it just someone who plainly doesnt get it? I hope this isnt the case - oh it would be sad to think that someone next to me might be perpetrating a coding-crime like this, and actually mean it!
Admin
I don't do much C# but I would assume they removed localized Boolean string-castings as of VB6.
<font size="1">I may or may not be wrong</font>
Admin
They know something you don't. In 2012, MS will release a quantum computer compatible version of the .net runtime that will replace the two-valued boolean with a fuzzy value that can take any value between false and true. Think of it as a float, constrained to a value between 0 and 1. 0=false, 1=true, 0.5=maybe, 0.2=rather not, 0.9=most likely etc. The way they programmed this property, they can make sure that only true and false slip through, not those undecided other values.
Admin
This is not a WTF - it is just garbage.
Where's the brillance?
Where's the juice?
Where's the factoring of CSS back into each and every element to which it should be applied?
Where's the inspired stupidity?
The essential 'NOT GETTING IT'?
A WTF is breathtakingly a WTF.
This is not even worth a comment.
I seriously considered not pressing the 'post' button. I think I will just blow away the window...
Admin
I'm pretty sure it's a forum
Admin
Yes.
Admin
Pffft you don't need infinite lines, you can recurse infinitely!
Now, in PHP that's a funny useless waste of processor time
Admin
Admin
Obviously they were trying to address the quantum theory of superposition. One can never know if a boolean is true or false until it is acted on.
Admin
I surf the Quantum Foam.
Admin
That made my day. Thanks!
I wonder if this outsourcing shop was CMM level 5. I wonder if it had all this redundant code because it was CMM level 5.
Admin
Nerd fight!
Admin
I would have to guess a code generator did this. No sane person would go though all of that without having to think to themselves, "This looks so enterprisy!"
Admin
Oh ho, you laugh at this WTF, but it's not a WTF, it's a carefully planned performance upgrade! Just think about it.... they can increase the performance of the ISO9001 property by an order of magnitude in their next version by simply deleting the ToString().ToUpper() calls and the senseless "make sure it's a boolean" check in the set method.
I'm telling you, this isn't a WTF, this is planned incompetence!
Admin
Hehee... am I the only one imagining Kyle and Cartman's limp-wristed slap-fight on South Park last week when I hear those words? [:D]
Admin
So... does verifying that all booleans are either true OR false, help one become a ISO 9001 compliant enterprise programmar?
Admin
When I read the title I feared some guy managed to programmatically go through several internet protocols, office documents and executables just to validate a value. Compared to the other wtfs this is just harmless tomfoolery.
Admin
Could this be the remainders of code refactored from
public string ISO9001 { get {...} set {...} }
or worse
public object ISO9001 { get{...} set {...} }?
Admin
This is definitely an applicatino of String Theory!
Admin
If IsTrue()?
Admin
I think you missed the point of the LOC metric. Clue brick - coming your way.
sincerely,
Richard Milhouse Nixon
Admin
IMO, a programmer doesn't have to vomit into his IDE in order to produce a WTF. Someone had to understand that a boolean produced true or false, and then added logic for those "other" values. Think of it like this... if I, as a developer, walked up to you and said, "If I don't want a boolean to be true or false, what value do I set it to?", what response do you think would go through your mind?
Anything that makes you say WTF... is by definition, a WTF.
Admin
Is an applicatino one of the fundamental particles of computing?
Admin
This is one real whopper. Really...just off the charts.
Admin
Order now! And get a free press release from Microsoft stating how much they are better than Linux.
Next-Gen Boolean, It's just Brillant! And you knwo, Paula (who is now outsourced to Mongolia) said it!
Admin
Wouldn't it simply not compile if value wasn't a bool? The property is defined as a bool, therefor, value will always be a bool, no?
Admin
<font size="2">come on! does Paula code in c# too?
return 'Brillant!';
</font>