Your Daily Cup of WTF - Because New() Fails Way Too Much

First and foremost, thanks for the WTF submissions! Please keep 'em coming. They don't have to be code snippets or diagrams, just something technical-related that made you say or think What the F--! And now that I think about it, I'd love to see some crazy Boss Emails and Memos. I had a trove of them saved from the last company I was at, but lost them all. So let's see yours! Just use the Contact Form, and feel free to include a website to link back to.

With that out of the way ... I give you this.

Three points for checking to make sure that the built-in New() construct actually created an instance. But, WTF was the coder thinking by not putting in “If Not TypeOf objNews Is clsNewsObject” code? What happens if the type of objNews changed after checking if it was Nothing?

Cross-Posted From TheDailyWTF.com.

1 Comment

  • Perhaps I don't do a lot of VB.NET work, but constructs can fail and thus if you know they can fail, you should test on that. So I don't see what's the big deal :)



    (I'm more concerned about the exception being thrown without any description)

Comments have been disabled for this content.