Friday, June 17, 2005

My own Daily WTF

What would you think of a programmer that coded an abstract class as a concrete class, and, instead of marking a few members abstract, implemented them as virtual and threw a "NotImplementedException"?
Well, I can imagine your face, and yesterday I was strugling again with System.Net.WebRequest and its memory leaks, trying to implement a new HttpWebRequest that used only WinHTTP to eliminate memory leaks definitively from every WebServices call we have. The funny thing is: WebRequest is a class coded like that. Someone at MS certainly think it's brilliant coding like this, and throws NotImplementedException on their code, instead of marking their members abstract.
A friend of mine here insisted that MS is not that bad at coding (and I do agree), and that there should be a good reason for that.
Today, I was reading my RSS feeds, and I found this post at The Daily WTF, describing a similar situation...
Sorry for my friend, but I really don't think that there's any good use for something like this.

I think there are good uses for this techniques. The internal structure requires all the methods to be implemented, but you can implement the structure yourself. He could use the Interface idea if he would be writing code in C# or Java (would be more tedious for him - and harder to understand for you) but unfortunately there are no interfaces in C++ -> thus the Virtual Methods that he declares and you need to implement.
Had you ever completed this C# wrapper for the WinHTTP library, I cannot seem to find it anywhere, even though you've posted about it quite some time back?

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?