- 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
Admin
I kid you not.
I need to go back in TFS and find the one that is even worse than this, and is closer to the article.
Admin
Fixed.
Admin
That isn't so bad. retval isn't intialized, but it has test for Nothing and exception handling which makes it better than average for VB.NET
Admin
Well, apart from being in Visual Basic, the main problem I have with that method is that the list items don't have a value set to "true" or "false". And even then, you have to fix the calling code to do it right. (Chances are this method is being called with different lists in different contexts, some of which are "yes/no" and others of which are "true/false".)
Minor demerit for handling exceptions right in the method; the only exceptions you ought to be able to get off that code are for unexpected Nothings, which can be easily checked for (as long as you're checking the argument for Nothing, why not the Items property and the ListItems contained therein?).
Admin
This is after a cleanup, but the code wasn't replaced since it's in that "working" state that you don't want to change.
Btw, I've found that C# developers make worse mistakes than VB developers. Maybe that's just my experience.
The developer for the above code is the exception, though. I could write a book with all of his WTFs, like this one:
Admin
I like the idea that these are bytes because this needs to be serialized for someone who expects this typeo.
Admin
would that be considered a "fasle assumption"?
Admin
I recently broke my g-string while I was fingering a minor.
Admin
Yeah, just because "blue" translates into French as "bleu" doesn't mean that it is treu that if a Francophone steps into the darkness without a torch that he will be eaten by a greu... everyone knows that grues hate the taste of French people! Get a cleu!
BTW, am I missing something obvious about Java, or does allocating some teensy tiny little byte arrays REALLY cause Java to run out of memory after a few hours? Or was the crash coming from being unable to parse "fasle" as a boolean properly? You'd think THAT would happen more often than that...
Admin
I once inherited (and later disinherited) a VB program that compared a Boolean variable to FLASE. Since FLASE wasn't declared and wasn't assigned a value, it was 0, and the program worked.
Admin
The writer of the function has made it perfectly clear about its purpose, i.e. to convert boolean to byte array. What's wrong with that?
(Yes I know about the typo, but it could have been just Carl mistyped it)
Admin
Are you talking about the one you ran off to France with last week?
Admin
No, that's not the way.
Just call the above method any time you need to use toAsciiBytes.
Admin
Admin
Admin
The method itself is really not that WTFish if you consider the possible context.
This is a tomcat server. Therefore there's a high chance this web service also made external requests. Therefore it's possible that there was some kind of layer between application services that made representations of objects as POST bodies, which are transfered in bytes.
Many POJOs have Boolean values, but when that value is a part of a POST body for transport, you probably want it to be the words "true" or "false" (i.e. human readable). IF I'm writing a layer of code to marshall my POJOS in a consistent manner, I proably have a function somewhere to turn boolean fields into the correct text representation.
Now, misspelling false? Yeah, that's a WTF. But instead of blaming "code that seems to not do anything in my small understanding of what's going on with the app" instead of profiling and monitoring to find the issues is also a WTF.
Admin
Syntax highlighting. What's the WTF? Of course the markup would be a bit shorter by using classes instead of inline style, but not anywhere near a WTF.
Admin
This seems to be perfect example of new n-state Boolean approach, they should upgrade Tomcat to cope with it.
Admin
Actually it PROVES why this is bad... For the most part, with today's computers. It isn't about whether this line of code runs it 5 cycles or 6... It is how easy it is to maintain down the road. How easy or hard it is to write buggy code.
Tell me how good this code is, when you can't figure out why "false" isn't doing what you think it would.
Admin
"Fasle" - sounds very similar to German "faseln" - and that means: drivel (talk nonsense). What a true statement for that code!
Admin
Admin
Admin
Nah, I'll verify that for you. Just last week I cleaned up a form with a bunch of combo-box handlers of the form
For each and every single combobox on the form. Never mind that it's a million times more maintainable to, you know, use the sender parameter and have a general handler to handle all of them: