- 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
Way funny! Incredible :))
Admin
The name trueandorfalse is just dumb. Are those supposed to be boolean operations applied to the input or something?
I think a much better name would be boolean todayIsBackwardsDay(boolean input) ...
Admin
booInpt?
As in trying to spook the input?
Admin
Admin
http://www.tampabay.com/news/article1012148.ece
Admin
Ah, so it's a formatting problem. Clearly we need an overloaded method that takes an IFormatProvider.
Then we can do trueandorfalse(wit,new EncloseInBracketsProviderAndAddExclamationPointFormatProvider());
Admin
Er, in C#, a bool only HAS two values -- it can't be anything other than true or false.
If you're concerned about that, just throw in a guard:
Admin
Are you seriously suggesting NOT sanitizing your Boolean inputs? WTF?
Admin
there, ftfy
Admin
Where do people learn that they should compare booleans to the value of true.
I see people around me doing it. I don't get it. I've never compare a boolean, only test it.
Admin
qft
why the hell do we see "if (value == true) " instead of "if (value)"
i hate that, especially with a well chosen boolean name it reads so much easier to test for it instead of comparing
it's also less confusing if you are testing for empty arrays or whatever, then they aren't really true or false, just empty
Admin
In C# if you are using a bool? (nullable bool), you would need to compare it to true since it could be true, false or null.
i.e.
if (nullableBool)
doesn't compile because nullableBool isn't a bool.
Of course, this isn't the case here, but it could be a habit.
Admin
After writing that last comment about comparing booleans. I think I realized why.
In undergrad university I took lots of math (including sets), plus some philosophy (including logic). Maybe that's why I've always programmed with booleans as abstract logical values. Of course it helps if you maintain and study good code from other good programmers.
Those who program with booleans as just another base type do have to compare to 'true' as the test.
Sound reasonable ?
Admin
Maybe they have been using the following header:
#define true 0 #define false 1 #define maybe 9
Admin
im sure you mean: "..encloseinbracketsproviderandaddexclamationpointformatprovider.."
Obviously the author of trueandorfalse adheres to very strict coding standards. he'd be most upset if you were to introduce all these strange looking characters in the middle of the method name.
Admin
Are you sure that the C# bool does not provide for FILE_NOT_FOUND? If that's the case then nobody should ever use C# ever again.
Admin
Jeez. C'mon. We all know it's 3!
True, False, File_Not_Found
Admin
Or they learned the trade using COBOL or some other language very unlike C. In some languages boolean operators are only used within the context of statements like if and while (or their equivalents).
If that is your background it takes some getting used to the idea that a boolean is a first-class object, just like someone with a background in Java or C# will need to get used to a language where classes, methods and functions are first-class objects.
I wouldn't call it a mental illness unless people stubbornly keep failing to pick it up, and even then I've seen worse things.
Note to self: time to start learning Lisp
Admin
You have to give him credit for the awesome comments tho :D
Admin
Lame and uninformed. There is an other WTF.
Admin
I hate how the method name is spelled (No capitals for Camel-style), I hate underscore as argument name and I hate whole method reason to exist as all people above mentioned already...
And I love comment about scientology, hke, hke..
Admin
I usually write it as "if (value === true)" in Javascript, because
For C# and other statically typed languages I agree with you.
Admin
Admin
Yeah. How do comment a "!" ?
Admin
If I'm testing for truth, I'll do "if (value)", but for the opposite, yeah, I'll do "if (value == false)", simply because it makes the code easier to read than using the ! operator.
First though, I'll try to refactor so that I don't have to test a boolean for falsehood. This is something one of my old college instructors drilled into us. Seems like an insignificant thing, but it really can make it easier to get a handle on code you haven't looked at for ages. Probably because it more closely mirrors human thought processes. Start throwing in negatives, and, well... confusion ensues.
Admin
But if today really was backwards day, then it would leave the output the same as the input...
Admin
In my head, why do I hear this in Yoda's voice?
Admin
Admin
Personally i find this (value==false) to be aesthetically unappealing. its a worthwhile habit to have if you code in c/c++ where the if checks against zero values. in which case it would probably be a good idea to also do the (value==true) side.
In other languages i prefer using meaningful variable names. (i.e. isSomethingOrOther).
Admin
I guess its because he's "clever". Based on the name, I would expect it to be like this:
Now, that would be an undisputable WTF.
Admin
ftfy... HIGH FIVE!
Admin
So, someone tells this guy there is a ! operator. He quickly realize his mistake and corrects the code like this:
///
Admin
See, I'd use an enum there with possible values of "Something" and "Other". If you use a bool, does a value of true mean "Something" or does it mean "Other"? Alternatively, use a bool isSomething where it is implied that if isSomething is false, then it must be other.
Admin
We now have Scientologist trolls?
Admin
Admin
Not!
Admin
Admin
Clearly the entire purpose of this function is to sneak in a Scientology joke.
Admin
Have you ever even used SandCastle (or equivilant) to generate complete documentation [the equivilany format and content of MSDN for example] for your code??????
Having the documentation close to the source dramatically improves the chance that it will be maintained.
If you are against XML per-se as the syntax, then what would YOU recommend to place: code, parameters cross- references, examples, summary information, additional remarks, etc. etc. inline with the code?????
Also what tool would use use to validate that the information was well formed???
While many people only use the be anything that follows this schema:
<?xml version="1.0" encoding="utf-8" ?><example />
Admin
_booInpt has got to be the worst name for a variable ever. Might as well just hit random keys.
Admin
I don't understand why it's OK to make fun of Scientologists just because their religion is "new" or whatever. I'm sure this guy would've been reprimanded or even fired if the same comment was put there about Christianity, Judaism, or whatever and someone actually read it. (I'd have listed more religions but my brain appears to have blown a fuse). I can list just as many bizarre things in the "old" religions as in Scientology.
On another note, it is my personal opinion that L. Ron Hubbard was either a nutcase (please note I am not a fan of any religion, mainstream or otherwise) or a genius. I believe he made a comment sometime before Scientology appeared about how 'if you really want to make money you'd get into religion' (or something, I've botched the quote) and then tada, he starts his own religion and becomes massively rich before he dies.
Admin
It shold look like this:
Admin
(Attempt #3)
"Witn't"
Captcha: "augue" v. to engage in a verbal disagueement.
Admin
L. Ron Hubbard taught me that.
Admin
That's what it's about.
FYI.
Admin
Admin
Admin
This and after giving the CoS $150,000 USD, you too can discover that it's just a UFO cult.
http://www.cs.cmu.edu/~dst/OTIII/spaink-ot3.html
Anybody suckered into paying $150,000 to learn about Galactic Overlord Xenu, has bigger problems than a couple of people "making fun" of their "religion" on some random IT/software message board.
Admin
No, making fun of Christians seems to be OK for whatever reason. (It shouldn't be.)
If he made fun of Jews, he would have been fired.
If he made fun of Muslims, he would have been killed.
He should be punished, regardless.
Admin
Don't be hating! They're just doing the needful!
CAPTCHA:ullamcorper...see, they're even taking care of the captchas!