Robert McLaws: FunWithCoding.NET

Public Shared Function BrainDump(ByVal dotNet As String) As [Value]

News

<script type="text/javascript"><!-- google_ad_client = "pub-4330602465258980"; google_hints = "ASP.NET, VB.NET, C#, C#.NET, WindowsForms, .NET Framework, VS2005, Visual Studio, XAML, WinFX, Windows Workflow, WPF, WCF, Atlas, NetFX3, Visual Studio Orcas"; google_ad_width = 120; google_ad_height = 240; google_ad_format = "120x240_as"; google_ad_type = "text_image"; google_ad_channel ="4997399242"; google_color_border = "B6C9E7"; google_color_bg = "EFEFEF"; google_color_link = "0000FF"; google_color_text = "000000"; google_color_url = "002C99"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<!--
-->

You should feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever. That said, I will most likely only delete abusive, profane, rude, or annonymous comments, so keep it polite, please.

Blogroll

Cool .NET Articles

My .NET Tools

My Builder.com Articles

My MSKB Articles

August 2004 - Posts

Interesting Research Programs @ ASU

ASU's been doing some interesting things with technology lately. Kenneth Spector is an ASU student who completed an internship this summer as an SDET on the Office team. Channel9 recently did a profile on his work at Microsoft. Why was his experience different? Because he's blind.The video's about 12 minutes long, and it's worth watching.

ASU has a lot if accessibility programs going on. Wired Magazine recently did a whole piece on something that I got to see up close and personal earlier this year. The system is called iCare, and it uses a sophisticated camera system and the .NET Framework to scan books, and read them back to you in real time. At the time, I was amazed, and now even more so. This stuff is really cool. I hear at some point the Lions Club is going to have them installed in libraries. Can't wait to see that happen.

Speaking of Service Packs...
When the heck is .NET 1.1 Service Pack 1 supposed to be released? I though it was supposed to be "synched with Springboard"?
.NET 1.1 By Default on Windows XP SP2?

I recently wiped my system and installed a clean copy of Windows XP with Service Pace 2 slipstreamed into the install. I didn't get the chance to check this after the install was done, but there is a DOTNETFX folder in the root of the CD. It's in the SP2 CD that MSDN just shipped me as well. Which leads me to ask the question...

Is the .NET Framework 1.1 installed by default in Windows XP Service Pack 2?

If it is, the ramifications are huge. Suddenly, the Framework is running on millions of desktops by default. Makes life a lot easier for a lot of people. And a lot harder for others (Sysadmins). Interesting. Can anyone answer this for me?

eWeek Blogs Running.... You Guessed It: .Text (Oops, CS::B)
Check it out for yourself. .Text is everywhere. Awesome.
Running Windows Media Player 10 on Windows XP Service Pack 2

I came across this problem while I was beta testing the XP SP2 release candidates. Every build starting with RC2 and later would not let me reinstall WMP10. It was very frustrating. Well, tonight I came across a solution in the WMP10 Beta Newsgroups. It involves removing specific keys from the registry. The problem is, those keys may vary by name, so a simple registry script will not work. So I whipped up a simple command-line program that will cycle through the proper Registry key, and delete all its subkeys.

PLEASE NOTE: This problem only exists for Windows XP Service Pack 2 - Build 2142 and later. Running this program on the Service Pack 2 RTM without having installed previous builds should not cause a problem. That being said, there are no warranties, express or implied, associated with this utility. It is provided as-is. Use at your own risk.

Download WMP10-SP2fix.exe.

Enjoy.
Provider Model Misconceptions

Paul van Brenk does not understand the Provider Model that is built into .NET 2.0. I don't think a lot of other people really get it either. His argument against using abstract base classes is a common one for anyone that has been doing COM/COM+/C++ development.

For the past 15 or so years, if you wanted to create a pluggable architecture, you used Interfaces. They define a signature that classes must implement in order to conform to that Interface. He says that this is the best way to go, and he is incorrect. I can see where he is coming from though, so let me clear the air a bit. Most of this is taken from my two hour presentation on the Provider Model, which I'll post online sooner or later.

Providers with Interfaces

  • Pros
    • Straightforward
    • No type conversions
  • Cons
    • Impossible to version
    • Hard to maintain
    • Does not scale well
    • No default implementation

I'm not going to hit on the pros at all, cause that much is obvious. But lets look at the cons. Interfaces are immutable, making versioning them impossible. Once an interface is made public, you can't change it without breaking the contract between classes that the Interface creates. Paul talked about the abstract class way being a maintenance issue... how easy do you think that maintaining 4 different interface versions would be? What about 5 or 6? Do you really want to have to worry about whether you should implement ICoolMethod, ICoolMethod1, or ICoolMethodEx? Finally, you can't have any default implementation, or implementation that every provider should share. All you get is the mold by which all implementing classes should conform to.

Abstract base classes solve all those problems. First of all, that common contract between classes is created through an inheritance chain. This is accomplished by implementing the Strategy design pattern. It's a more OOP architecture. For anyone coming from a VB background, it should fit like a warm glove. Using this method, you'll be able to create a base class, like MembershipProvider, which serves as the "face" of the Strategy pattern. This class not only defines what the rest of the providers will look like (because this class is marked either "abstract" or "MustInherit") but it also defines default functionality that every provider must implement.

This makes life easier for plugin developers in many ways. First, it's much easier to version. You can add functionality at any time to any part of the inheritance chain without breaking any existing code. If you add something to the base of the chain, every part of the chain above that has access to it. Therefore, it allows you to scale functionality up (by adding new capabilities) as well as out (by adding new providers).

Now, Paul was upset because of a percieved need to implement every function, which he says can be eliminated by using Interfaces. This is patently false in just about every aspect of his complaint. First of all, you have to implement every method on an interface, or it won't conform to that interface, and therefore, it won't compile. Second, the functionality issue is easily solved by making your provider default to a certain value (if Integer, 0; if String, then String.Empty; If boolean, then false, etc) for its operations. Then, you only override functionality that CAN be accomplished, thereby saving on the amount of code to write.

Paul suggests that you throw a "NotImplementedException" instead of provifing default "null" values. This is an extremely bad idea. Exceptions are expensive to throw, and expensive to catch. The Provider Model architecture was not designed to be a guide as to what should be an exception and what shouldn't/ You may so choose to throw exceptions in your provider based on certain runtime criteria. But you should not throw an exception if a method is not defined. Instead, your calling code should be able to handle and empty or null return value in act in less runtime-costly ways.

There's a lot more to the architecture than this (remember my presentation was two hours long), so this is about all I'm going to tackle for now. Just remember that, if you're coming from a C/C++/C#/Java/COM/COM+ programming background, this is probably a little Greek to you. But if you understand the underlying reasons for the architecture, it makes a whole lot of sense. And since Microsoft had built this functionality into the base of the Framework, you're going to see a lot more of this architecture.

And be careful. All Provider Models are not created equal.

Windows XP Service Pack 2 Available Now

News.com is reporting that XPSP2 has officially RTMed, and the final build is available on the WindowsBeta site for all Windows beta testers. Since it has RTMed, I can finally say that I have been beta testing these builds since LONG before the release candidates, and Microsoft has done an AMAZING job with this pack. Personally, I consider it a new version of Windows.

To get it, make sure you have Automatic Updates turned on. Windows will use the spare bandwidth to trickle the 80-some-odd MB download to your machine. If you'd rather do it outright, then I'm sure they will have a network install public download in a few days.

XP2 RTMs Tonight, MSDN Access Tomorrow

Neowin is reporting that the final Windows XP Service Pack 2 (or XP2 as I like to call it) will be compiled this evening. The Network Install should be available tomorrow for Microsoft.com users and MSDN subscribers, and will be available via the next version of Windows Update on August 25th.

Microsoft is going to be doing a huge marketing push on this one. You can expect to see new ads on TV and in magazines, free cds in computer stores, and I wouldn't put it past them to include the CD in the next MSDN mag shipment or something like that. Microsoft's answer to security-related support calls for a while is going to be "Install SP2, then come talk to us."

Microsoft Enters Blog Fray Against Blogger.com in Japan

Hot off the presses: MSNBC is reporting that next week Microsoft will launch a free blogging service in Japan. This service will allow users to update entries from a PC or mobile device. The Reuters report did not mention which back-end engine the service will be using, nor did it mention if the service would be available in the US anytime soon.

More Posts