- 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
What in the name of all that is sweet and cuddly is THAT?
Admin
Where the hell is this Hotel..... I wonder how many reservations go to "hell in a hand basket" with this system? Angry [:@]
Admin
W O W
Admin
That's looking directly into the eye of The Beast, my friend.
I like that the worst of the worst are re-run every once in awhile, to treat the new readers who may have missed out on the first fly-by. Then again, there are the archives to search through.
Admin
This might be the WTF of the year.
Admin
Oh, and I have seen snippets of this beast before. I think this just takes the cake.
Admin
Is it possible that using this system is more complicated than the code behind it?
Admin
The German adds a nice touch.[H]
Admin
This tastes like burning.
Admin
Maybe the Germans shouldn't be allowed to develope anything computer related.
Admin
Imagine it works: Isn't it beautiful?
Admin
My seven year old did that just yesterday using MS Paint! [:|]
Admin
This is a baby that only a mother could love.
.jc
Admin
was das bumsen.
(Hint: German)
.jc
Admin
More correctly:
WAS ZUM FICKEN?
Admin
Google translate is only 'so' good. :) Thanks for your correction.
.jc
Admin
http://en.wikipedia.org/wiki/Zuse
Admin
So... where are all those people who were vehemently supporting the ternary operator the other day?
Actually, I already know: They're sitting in a dark room right now, all of them curled into the fetal position.
Admin
Though you wouldn't say that in german. Something more likely to be heard is: "Was zur Hölle?" oder "Was zum Teufel?" (What the hell? / What the devil? (?))
Admin
Today's WZF is brought to you from Deutschland.
I have to maintain an Access form that has two dozen toggle strip buttons on it...and all the tabs have at least three forms with two-level-deep subforms each. The form itself takes almost five minutes to go into design view, and that's on a P4 2.8ghz with 1gb ram. I shudder to think of just how long it takes to design, edit, and save this masterpiece. And trying to track down one bad entry in a query source like that?
:shudder:
Admin
Ah, german engineering. Strangely enough, no fahrvergnugen.
-D
Admin
IIf != ?:
Admin
Zuse would turn in his grave if he saw that.
More often than not when I had to deal with German software vendors, their products turned out to be complete crap under the hood. May be coincident, may be not...
Admin
There's a ternary operator in there?
Admin
We Germans are good at computing... err... at least sometimes... I think you just should not let any German older than 30 do programming work, they tend to do it the "old school style"
Admin
with hope, no animals died during the testing of this fetid hulk of programatic depravity.
This diabolic incarnation of hatred of mankind is proof that true, distructive and unprovoked evil can exist and live outside the symbios cirkle where an equaly heavy form of 'good' would ease the torment.
In other words: this proves that there is no God!
Admin
Yep. Sick, ain't it?
IIf is VB's ternary operator. It works like this:
IIf(condition, value if true, value if false)
The exact ternary operators being nested in that example:
IIf([Dauer]=5,"-------------------------",IIf([Dauer]=6,"Summe Kat. " & [MAINKAT],IIf([Dauer]=7,"=========================","")))
Which gives:
"-------------------------" when [Dauer] = 5, "Summe Kat: " & [MAINKAT] (string append, basically) when [Dauer]=6, "=========================" when [Dauer]=7, and "" otherwise.
and don't forget this one too:
IIf([Dauer]=5,"-------------",IIf([Dauer]=6,Format([f z tgab 0101 2 1 4 1].[BR],"Standard"),IIf([Dauer]=7,"=============","")))
Yeesh.
Admin
Admin
What school is that? Kindergarten? ;-)
Admin
What the hell?? I don't recall my message looking like that when I was mashing my feet on the keyboard....
Admin
For even more fun, that ternary function known as IIf in VB doesn't do short circut evaluation. Think about that in terms of speed. [:'(]
Admin
The speed is a killer, but my favorite part is that if you put functions in the true and false criteria, it will execute both of them before performing the evaluation.
a = IIf(0 = 1, RunProcess1, RunProcess2)
Since IIf is a function, it will attempt to send the results of the functions to the IIf function as parameters. It's painful to try to explain to other VB folks why IIf is not a good idea.
Admin
I really don't think speed was a consideration while designing this beast.
Admin
We should all say "Thank you" to big MS (mess ?) for giving us Access. It's a nice desktop database but it gave an awful lot of incompetent people (especially suits) the impression that developing with databases is easy and can be handled by hobby programmers. There you have it, a fool with a tool is still a fool.
Admin
If TDWTF has teach of something, is that there is no language, operator or fuction that cannot be use in a WTF. I think only common sense is excluded from the WTFs.
Admin
IIF() is a function, :? is a operator.
There is a difference, you know.
LP,
Dejan
Admin
he he .. it's funny how many people here are trying to be "clever" and "witty" by making fun of the IIF() "operator" ...
It's a function, boys and girls.
I know it's fun to bash VB, but let's try something more original.
Admin
Hey Manni, why is IIF() "not a good idea"? Please be patient and explain it to me. When you say "not a good idea" to you mean:
* It was not a good idea for the guys who wrote VBA to include an IIF() function ?
* It is not a good idea to use this function if you think it's an operator?
* It is not a good idea to use *any* functions if you don't understand how arguments must be evaluated before the function can be called?
* It is not a good idea to confuse operators and functions?
* It is not a good idea to spell something "iif" ?
Help clear this up for me.
Admin
Who else would you like to arbitrarily exclude with a crazy rule? Gypsies? Jews? Homosexuals? Did I miss any of your usual targets?
Sincerely,
Richard Nixon
Admin
In my opinion, for all practical purposes, an operator is a function.
When I write an operator overload in C#, it looks like this:
<font size="2">public static bool operator ==(ObjectName x,ObjectName y)</font><font size="2">
</font><font size="2">{</font><font size="2">
</font><font size="2"> </font><font size="2">// Do whatever to determine equality
</font><font size="2">}
</font>
Looks like a function to me.
Admin
OK ... boy, do I feel clueless, I am just not getting most of these posts. Is your point
A) C# let's you overload operators with functions ! It's a neat language!
B) "Using VB is the WTF!"
C) Operators and functions are the same thing in all languages !
Can you help me out?
Admin
Um... Operators are Functions, thats why you can overload them in C. You overload the function that the operator is a weird calling convention for. And like all functions the parameters are generally evaluated before being sent to the function which is why in the 'defense of ternary' thread, even those who support their use made sure to clarify that you should never use parameters that have side effects. If you need a decision tree that has side effects you need to use If structure instead.
Admin
hmmmm ... can you explain to me how short circuiting works?
Admin
C# is a neat language, but that's not my point. I'm just saying that for all practical purposes, an operator is not so different than a function.
"Greater than" takes two parameters, evaluates the expression according to the rules in comparison for the two parameters, and returns a boolean value indicating the truth value of x > y.
I'm NOT saying that they are the same thing, just that operators behave similarly to functions.
Suppose language X didn't have a built-in ternary operator, but had a function called JeffS(expression, value1, value2) that returned value1 if expression is true, value2 otherwise. Now suppose a programmer new to language X asked if it had a ternary operator, would you say:
1) "LOL OMFG NO!!!"
2) "Kinda, it has this function called JeffS, and it works essentially the same way."
Admin
That's how you define the operator, but you invoke it like this:
if (x == y){
// yada, yada
};
not
if ==(x, y){
// yada, yada
};
[H]
Admin
You can create operator overloads in VB.Net, too. (VS2005, that is)
<FONT color=#0000ff size=2>Public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Class</FONT><FONT size=2> test
</FONT><FONT color=#0000ff size=2>Public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Shared</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Operator</FONT><FONT size=2> =(</FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> ObjectX </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> test, </FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> ObjextY </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> test) </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Boolean
</FONT><FONT size=2></FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Operator
</FONT><FONT size=2></FONT><FONT color=#0000ff size=2>Public</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Shared</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Operator</FONT><FONT size=2> <>(</FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> ObjectX </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> test, </FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> ObjextY </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> test) </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Boolean
</FONT><FONT size=2></FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Operator
End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Class</FONT><FONT color=#0000ff size=2>
</FONT>Admin
I'd say:
There is not a ternary operator defined by language x, but somebody wrote a convenient function that resembles the behavior of a ternary operator.
.jc
Admin
In C, the following statement will not call function().
Why bother to evaluate the second operator, when the result is already a foregone conclusion?
In VB, that function will be called, from what I gather.
This is often seen inside an if statement, like so:
As well, this is sometimes used for pointer checking, like so:
Without short circuiting, the ptr->next will always be evaluated, even when ptr is NULL.
Just as an aside, I am wondering now, if yesterday's WTF, the guy who did not understand boolean logic, was confusing boolean logic and C bitwise operations, such as:
Admin
Congratulations, you just chose option 2! You just rephrased it to fit your particular speaking/writing style!
Admin
Awww crap, I called a 'function' an 'operator'!
There goes my credibility.