- 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
TRWTF: "didn't migrate history"
Admin
TRWTF, no frist post :O
Admin
TRWTF: "noprob". not never un-use non-negatives as non-parts of unboolean unvariables.
Admin
"Exception eee"
I feel that variable name is appropriate, as "eee" is the sound you make when you see this code.
Admin
I don't dislike this rule of thumb.
Admin
WASPs? (white anglo-saxon protestants)
Q. How many arrogant WASP engineers does it take to refactor silly code?
A. (sneering) One.
Admin
It's probably because this is in an event handler where .NET defaulted to e for the event arguments.
Admin
The “hack” is 50% necessary depending on your compiler settings and the part of the code that we do not see here. You might get a warning if you initialize variables within a code block but declare and use them on the outside. If you chose to "treat warnings as errors" then you are stuck at this point.
Admin
Web Application Security Protocol, you fool!
Refactor it to your hearts content, Remy.
Refactor Refactor Refactor
PS: Don't be evil.
What's evil? The absence of good.
What's good? What we say is good, including spinning up clones in China, executing them in soccer stadiums, and then harvesting their organs.
I bet facebook could do it now just on phrenology alone.
Hey, why not? Great pay day!
Google===0
PS PS: Adsense sucks. Want a universal wage? Pay your publishers!
Some light reading for this Easter Sunday, folks!
Chou!
https://bit.ly/2GwzRGy
Admin
Woops!
Wrong link!
Sorry, for real!
https://bit.ly/2GH4k4R
Keep it up bitly and outlook. My patience is great and my memory is long.
Admin
PS PS:
You can "phase" the hubble in accordance to the natural frequency of EM emissions of Planet Earth to see well into the past.
Don't worry about signaling aliens, just dump it off on AC, and make them the fall guy!
Brew up a big pitcher of ice tea, and watch the fireworks begin!
Admin
What I want to know is why does it create two WASPApplicationServer() instances, throwing the first one in the bitbucket immediately after creation?
Admin
Why, that's the hack to be able to compile of course.
Admin
Maybe
mainserver
was used within the catch block and the compiler didn't like that because the variable might not have been initialized.Admin
Stereotypical Jamacan programming? "noproblem mon"
Admin
To be fair, at least "throws the exception away" is not (obviously) true, as it does pass it to logger.error() first. Granted, this is damning with faint praise.
Admin
It's the sort of hack we've all done in the past - the code looks good to you and everyone who looks at it but fails to compile, so you try more and more ridiculous things, then once it works you don't ever touch it.
Admin
The real wtf is calling the flag noprob. It's a Boolean with wording that has a not in it. That causes so many problems. So the if check could be:
if (!noProb) // not not problem
Please people, always keep it simple:
bolean success = true; Then if an exception is thrown, set it to false. Then: if (!success ) // not a problem
Admin
I've seen that sort of thing done by places that had an automatic code review system that rejected all variable names that were shorter than three characters. Of course, everyone then just does the lazy approach of typing a single letter three times, making the code longer but otherwise no better. (I've also seen code that went the other way;
for (int the_innermost_loop_iteration_counter = 0; …
isn't something you want either.)Admin
The TDWTF is migrating to SVN in 2011.
Admin
True story: I work with developers who like to wrap their entire program in a try except clause, and in the except clause simply print "this is broken" and never raise the error again.
Admin
I think that, as St Grimes suggested, the "hack" was needed because a variable defined only in a code block isn't visible outside of that code block. To make it visible throughout the module, it had to be defined before the first code block. But I'm either not familiar with the language used, or the programmer missed the obvious...
Could "mainserver" have been defined (giving the name and perhaps the type) first without initializing it, or by initializing it to a null-filled structure so there was no possibility of a failure? That's what I would do in any flavor of c/c++/c#, even if I had to make it "void *mainserver;".
If the variable definition cannot be separated from calling the initialization function (which may depend on external conditions), the TRWTF is a language that includes try-catch blocks but does not allow the first definition/initialization operation to be in a try block.
Given both of these conditions (and it seems more likely that the programmer just didn't know how to properly use the language), the hack is a sort-of-reasonable work-around: define & attempt to initialize the variable first, ignoring failures, and then immediately re-do the initialization with failures being caught.
Admin
I agree. They should have been on it much earlier but at least they're on the best system now