- 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
This is obviously VB. With the VB VARIANT type, I would expect TRUE, FALSE and HALF-TRUE.
Admin
It could fail if File Not Found or in this case Email List Not Found nods sagely
Admin
This is good, simple, robust coding. Enterprise-ready.
Admin
Simple.
It may throw a YouCantHandleThisException
Admin
Likely a stub function that was intended to be expanded later and was never completed.
Admin
It was probably set up for the debugger and the function's true purpose--excuse the pun--was never implemented. Put a breakpoint on the return statement, run the code, and wait for the breakpoint to be hit. You then have the option to set "return false" as the next statement and see how the rest of your code handles it.
Granted, it should have been either removed from production or completed.
Admin
The Truth Is Out There
(no, this is not spam)
Admin
Admin
That is rather common on politics, where the True is ridiculed and the False reigns more often than not.
In programming, however, the real fail is on a different level - a placeholder template, in which probably not rarely only the first part is replaced by code that makes any sense. The result is what I call exception munching.
Admin
How can truth fail? Just ask a politician!
Admin
TRWTF is
Public Function EmailList() As Boolean
Admin
Public Function WTF() As Boolean Try Return CBool("Frist") Catch ex As Exception Return CBool("File not Frist") End Try End Function
Admin
I'm guessing you're being sarcastic or something, but just in case you're not - how could it possibly fail? It's an empty function, it doesn't try to load a file or an email list.
Admin
This look like VB .NET which is not same as VB. Of course Java is moraly superior to all these .NET stuff langeuages.
Admin
http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx
Admin
There was probably some exception throwing code in there at one point. Now that the code is no longer needed, it was just replaced with "return true" rather than just not calling the method. Wouldn't want to breakup some horribly complex logic when you can just return true. Plus, there's no harm in a little extra defense in your coding, no? I mean, after all, it does work. I could see myself doing this....when I was in high school.
Admin
Someone is going to say there probably was some code inside that was removed (probably when all of the email list's mail providers moved the company's domain to their antispam filter).
That someone is then going to say this is not a WTF, because whatever has an explanation cannot be a WTF, for some reason.
Admin
Hopefully this is the remnant of formerly more complex code that was refactored.
Also, he forgot to add 'finally'.
Admin
Admin
You have no support on this site. You're alone. Stop trying.
Admin
Don't you have a baby, frits? I've got $200 in my wallet right now, let's do this thing!
Admin
Admin
And I thought I didn't spend enough time here to know the memes :)
Admin
Admin
How could it possibly fail? Well, I don't know... but why would the programmer have written failure handling code if it couldn't possibly fail? Answer that, Mr. Smarty Pants!
Admin
You win the Internets today!
Admin
Admin
Admin
Admin
Admin
Admin
look no further than the next election...
Admin
But you hopelessly persevere. It's so inspiring...
Admin
Admin
Admin
Admin
Obviously C++:
Admin
This is clearly an attempt to address Russell's Paradox, albeit a poorly conceived one.
Admin
Then you certainly can understand him ;)
Admin
More than likely placeholder code that was never actually finished - I've seen it often.
What really, really, really, really bugs me though is having methods that have an int/bool return value to indicate success/failure when the method is filling an object or performing an action, such as loading something from the database or, in this case, sending emails. My work's code is littered with things like this:
Really bugs me, as it should be a static method (or, better yet, use a DAO/Gateway/Repository/etc) that returns the Foo object or throws an error (or, better use, uses the NULL OBJECT pattern).
Admin
Admin
Admin
Whatever, I guess when the daily posting is another round of a dead function reduced to a return true and not fully excised from the code, there's not a lot to say that's very pointful. Off you go, Hater. Knock yourself out. Just remember to put on your real fake identity if you think of anything clever to say.
EDIT ('cause I'm legit now!): What would it mean to "have support on this site" anyway?
Admin
fo sho.
Admin
So, what happens if the answer is FILE_NOT_FOUND, and the "Return False" fails, too?
Admin
No, you see now you've caused a semantic inconsistency, which is not in keeping with my joke. Doesn't work. Sorry.
And if you're still getting blood, ask yourself who the real amateur is. If you were more practiced (like me), you'd be a little tougher maybe.
Admin
Admin
Admin
Admin