- 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
Let me guess...you were debugging code written by Oracle...
Admin
Could they be trying to place a breakpoint within the method, so that anytime boolean is false debugger breaks? Otherwise, i'm with everyone else.
Admin
In most applications where performance is the key criteria and a moderate error rate is acceptable, this double redundancy is optional.
(In our next lesson, we will discuss introducing a "chaos block" into the code, to complicate things enough that the compiler cannot optimize away the redundant write. Since this will necessarily involve a maze of increment and conditional branch instructions to foil the optimizer, comments should be omitted from this region for performance tuning purposes.)
Admin
Oh, it's there-- you just got the name wrong. It's called isBooleanNotFalse().
DaveE
Admin
I think we need a WTF in FORTH or equivalent, just to get "embedded systems" the star treatment it deserves.
Admin
Funny, I was thinking this looked like the work of someone fresh out of school!
Admin
Shouldn't it be:
return (boolean)!value;
Admin
yawn So unimpressive. Show me an implementation for isBooleanFish(), and I'll be impressed.
Admin
There's no need to reset the variable so soon. You need to reset it thirty or forty lines further down when the charge may have leaked away from capacitors.
Admin
I will admit that I have made something akin to the isBooleanFalse() function, but for the following reason: readability. Instead of something like
I've created something like:
where isSituationResolved is obviously just an encapsulation of the above code. Because it reads better and has about 100x the amount of information in it. Clarity, many times, is more important than brevity.
Admin
For that you'd need to implement a high precision timer, so you can be sure a uniform wait is always observed. None of this Sleep() nonsense either, you need to access the system clock directly. However, a much more elegant solution is to entangle the two variables. That way, when you read either one, you will instantly know the value of the other.
Admin
Curiously enough, the jvm has no provisions for dealing with single bits. Booleans are treated as ints, internally. (see jvm 3.3.4, or javap some code and see what it looks like to the machine)
Admin
Admin
Your friend was a poet: isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(isBooleanFalse(toDie))))))))
Admin
Admin
This should be serialized to XML to make it better.
Admin
Yes, but with today's nanometer scale technologies, there's so much less charge to leak, and the leakage currents are so much higher that it requires frequent resetting of values to ensure optimal performance
Admin
Admin
Admin
Ouch!
#define IsBooleanFalseUntrueOrotherwiseDishonest(PossiblyFalseValue) (PossiblyFalseValue == (0 == 1) ? (1 == 1) : (((PossiblyFalseValue || (1 == 0)) && PossiblyFalseValue)?(0 == 1):(0 == 0)))
Captcha: causa... this codes gonna causa lotta wtf?
Admin
Admin
Let me introduce you to Paula Bean:
http://thedailywtf.com/Articles/The_Brillant_Paula_Bean.aspx
Admin
Admin
Congratulations, you've won this thread. Please stop by the league offices to pick up your internets any time after Tuesday.
Admin
FTFY
Admin
TRWTF is that three of those five are marked "not supported".
Admin
Oooh! such a warm fuzzy feeling now.
Admin
in other news, MS is now competing with thedailywtf
Admin
This reminds me of an article in a trade rag (I believe it was Datamation) that showed various responses to an interview question: "Write a routine that takes a variable that has the value of 1 and 2 and returns the other one (use any language)". The responses were just as verbose and usually wrong. Many had no error checking (not really a requirement), and all but one were as long at this. The winner was: return 3-input [or its equivalent]. It IS an interesting question to ask on interviews. I don't know how Paula Bean would answer it!
Admin
OK, I'll bite. What is an "auto-boxer"?
I did a search and it turns out it isn't "auto-briefs"!
Admin
Very well indeed.
In our programmes, we do indeed prefer to employ some definitions like those shown below in order to rid ourselves from some of the vulgarity found in those newfangled programming languages.
Admin
Admin
But where's the exception handling? Don't know you know that every function must have at least one try..catch block?
Also, for our next code review, I expect an appropriate number of units test for this complex function.
Admin
it's a gem!, not an example of over-engineering
it's a gem
Admin
Clearly "bool" is just "noob" backwards.
Admin
Where was the frist guy today? I was expecting a gem from this article...
I can't stand to even look at code like this:
if (checkIt() == false)
since I think
if (!checkIt())
works better. Some of the posts were like nails on a chalkboard!
Another pet peeve. It takes an extra few seconds to figure out the check blocks.
boolean notFound = true; while (notFound == true) { // try to find it I think... if (...) notFound = false; }
vs.
boolean found = false; while (!found) { // try to find it, I am sure if (...) found = true; }
Admin
Java has two types of values: primitive types and Object types. Each primitive type has a corresponding wrapper class that allows it to be used in a context that requires an Object type.
The process of converting a primitive type to its corresponding object wrapper type is called "boxing". The reverse is "unboxing". Since Java 1.5, this process is performed automatically at compile time in most situations. This is called "auto-boxing" or "auto-unboxing".
Admin
In your case, the info that you are adding with your encapsulation is not about that little "!" is about the meaning of ptr1->rec2.substructC.indicatorN
Admin
It's still a tri-state because three of the states are described as "Not Supported". Apparently, only msoTrue and msoFalse are actually supported, of the five defined states.
Admin
The saddest thing is I know at least one "chief architect" who would be nodding sagely whilst reading this post.
Admin
if (value == false) { return true; } else { return false; }
is shorter and doesn't include !
or
return (value == false);
Admin
Admin
Admin
"Everyone knows the value of 1 and 2 is zero, so that's always going to be the input. When you say 'returns the other one' I assume you mean that the function should simply return a '1'. Do you want that as an integer, float, or ASCII character?"
Admin
Admin
"You know, when dealing with customers we prefer employees who don't try to make them look like idiots, even if their natural language descriptions dont translate 1:1 to a computer program. (Hint: That's your job as a programmer.) There's nothing wrong with clarifying unclear requirements, but deliberately misinterpreting something whose meaning is clear with a little common sense isn't helpful. Thank you for taking the time."
Admin
There's for Forth for ya. And FWIW, there is no equivalent to Forth. Unless it would be APL.
Admin
fritz
Admin
Admin
At first, it seems like a shallow, simple WTF. But the more you examine the code, the more you appreciate its subtle layers of ingenious WTFery.
The first layer of WTF one encounters is in this precious line:
public boolean isBooleanFalse(boolean value) {
which would make the first WTF the notion that this function, which costs 17+Len(Expression) keystrokes to call, would be superior to: (Expression). The second WTF on this, the first line of code, is that, well, if I were to intentionally create something like this, there is no fucking way I would expose it to my public API.
But it gets better. The second line of code is:
boolean response = false;
Which translates in at least four different languages to:
world.laugh(me);
Then we come to the fifth WTF on the next two lines:
if (value == true) { response = false;
which wastefully performs conditional processing on an unconditional task, i.e. response = !value.
The sixth layer of WTFery is on the last line of code:
return response;
Since it should have been "return !value;" and just eliminate every other line of code in the function, assuming the function is needed at all, which it's not (WTF#7).
That's seven WTF's in seven lines of code, which is WTF#8.