Archives / 2006 / June
  • A great article on functional programming...

    This article was a great overview of many of the aspects of functional programming. With what Micosoft is doing to the CLR and C# and VB it would seem that functional programming is making advances into the main stream. His article has imaginary Java samples and if you squint your eyes when he creates a class to hold a function you can see delegates.

    I studied functional languages such as LISP and ML in college but quickly lost track of them after years of programming in corporate IT. To catch back up I've been spending the better part of a year studying functional programming concepts. While its been challenging at times, there have been alot of aha and oh yeah moments.

    Since I have a great comfort level with C syntax I started my ride on the functional wagon with COmega. This is where I really began to "get" things like closures. I even found myself purposfully writing my own code to mimic a closure in good ol C# 1.0 for certain situations like Regex match evaluators. Once you see the "patterns" that higher order functions exhibit you can write them in plain imperative code. This will make you hunger for language constructs to do this work for you. Its like writing OO code in assembly language.

    C# 2.0 Added true closures to the language with anonymous delegates. Woo hoo no more private nested classes to hold lexical context! (at least not that I write).

    At PDC I got to see the preview of C# 3. This takes anonymous delegates a step further with "lambdas". There's lazy evaluation galore with LINQ. It would seem that MS has been bitten by the functional bug. Even the Atlas client APIs make good use of the functional elements of JavaScript.

    I've also ventured out into IronPython and Ruby. These are great places to practice functional programming techniques.

    The real challenge moving forward is finding the right balance. Theres no doubt in my mind that functional programming techniques are headed to the main stream. With the populatrity of Ruby and Rails and Microsoft adding functional capabilites into C# and VB the winds of change are blowing.

    Link dump so I can keep track of what I'm researching:
    brianbec's blog:

  • Microsoft Robotics Studio ?!?

    Just ran across this on my daily news rounds:,1895,1978917,00.asp

    I think Lance and I saw some of this stuff at PDC. I dont think they had all the tooling around it but this def sounds pretty darn cool.

    I cant wait to start programming some lego robots with my son!

    Doh! Erik beat me to it:

    He's even got links to channel 9 videos.


    Tech Preview

    Channel9 Video


  • Patterns in .NET

    Andrew makes some obversations about MVC in the .NET world.

    I too have been delving into OO principles and patterns over the last couple of years. I'm still getting my head around the ups and downs of page vs front controller. ASP.NET uses a page controller pattern and frameworks such as Struts, Rails, and several PHP frameworks use the front controller pattern.

    There's some really good reading on these patterns in Fowler's Pattern of Enterprise Application Architecture. Also read everything you can on

    You can still implement front controllers in ASP.NET using an HttpModule or .ashx. The thing that turns people off to this is you ditch most of the IDE support for designers and most of the features that webforms give you (viewstate, postback etc). This is where you have to look around at some other frameworks that implement a front controller. Castle MonoRail and Spring.NET are two major ones that I have found.

    MS also seems to be getting more an more on the OO/Patterns bandwagon ever since .NET was introduced (Or maybe this is just when I started the transition). For example, the provider model in ASP.NET 2.0 is really awesome. You should def be using it to decouple your web tier from your biz/data tier. Check out this MSDN article on the provider pattern.

    If you want to go swimming in an ocean of patterns take a look at Enterprise Library 2.0. Lots and lots of good stuff in there.

    Another great book on practical application of patterns and refactoring to existing code is Feather's Working Effectively with Legacy Code.

  • Web Deployment Project frustration turning to enlightenment.

    Thanks to some great suggestions by Scott and others I have put aside any fears/laziness of delving into the msbuild script and managed to come up with an alternate way of changing web.config settings as part of the build process. While the web.config replacement stuff works for me at the moment, I like having this method around since it can be used to vary any kind of output as part of the build.

  • Frustrations with Web Deployment Projects

    Web deployment projects are an elegant way of integrating the compilation of an web site into a build process. I was initially really impressed with the msbuild task that replaces sections of your web.config at build time. Unfortunately  this feature is starting to dissapoint. As this forum post points out it is fairly limited in scope as to what sections it can modify. I recently tried getting the deployment project to update the section. I have yet to get it to modify this section. The build will just fail saying that it cant find This shouldnt be this hard. I hope I'm totally missing something and the rest of this post can just be ignored.

    Ok, Im the moron on this one. under is a group not a config section as I orginally thought. Once I changed the deployment project to this:;

    It worked like a champ.

    So the moral of this story is check, double check and triple check what type of node you are trying to replace in the deplyment project.

    I'm still not sure why it matters what type of node you are replacing.

    Update: Some good ideas here for more advanced scenarios.

  • How the ProfileCommon class gets compiled

    Lance and I were puzzling over the magic that happens when you configure the profile provider in 2.0. As you may or may not know it codegens a strongly typed class called "ProfileCommon" when  you set up the properties in the web.config. Our question was how is this codegen happening and how is it that I'm getting intellisense at design time.

    We both immediatly thought of the build providers. Those are plugins to that are used to generate code and compile specific file types. (e.g. web references, resxs etc.). You can write your own as well which is very cool. Anyhow this made the most sense but upon inspecting the main web.config there was no such build provider configured:

       1:  <buildProviders>
       2:      <add extension=".aspx" type="System.Web.Compilation.PageBuildProvider" />
       3:      <add extension=".ascx" type="System.Web.Compilation.UserControlBuildProvider" />
       4:      <add extension=".master" type="System.Web.Compilation.MasterPageBuildProvider" />
       5:      <add extension=".asmx" type="System.Web.Compilation.WebServiceBuildProvider" />
       6:      <add extension=".ashx" type="System.Web.Compilation.WebHandlerBuildProvider" />
       7:      <add extension=".soap" type="System.Web.Compilation.WebServiceBuildProvider" />
       8:      <add extension=".resx" type="System.Web.Compilation.ResXBuildProvider" />
       9:      <add extension=".resources" type="System.Web.Compilation.ResourcesBuildProvider" />
      10:      <add extension=".wsdl" type="System.Web.Compilation.WsdlBuildProvider" />
      11:      <add extension=".xsd" type="System.Web.Compilation.XsdBuildProvider" />
      12:      <add extension=".js" type="System.Web.Compilation.ForceCopyBuildProvider" />
      13:      <add extension=".lic" type="System.Web.Compilation.IgnoreFileBuildProvider" />
      14:      <add extension=".licx" type="System.Web.Compilation.IgnoreFileBuildProvider" />
      15:      <add extension=".exclude" type="System.Web.Compilation.IgnoreFileBuildProvider" />
      16:      <add extension=".refresh" type="System.Web.Compilation.IgnoreFileBuildProvider" />
      17:  </buildProviders>

    So what gives? Well Luts Roeder's Reflector to the rescue (again). It turns out that a build provider is being used but its added dynamically in code by the CodeDirectoryCompiler:

       1:  internal class CodeDirectoryCompiler
       2:  {
       3:      private void FindBuildProviders()
       4:      {
       5:            if ((this._dirType == CodeDirectoryType.MainCode) && ProfileBuildProvider.HasCompilableProfile)
       6:            {
       7:                  this._buildProviders.Add(ProfileBuildProvider.Create());
       8:            }
       9:            VirtualDirectory directory1 = HostingEnvironment.VirtualPathProvider.GetDirectory(this._virtualDir);
      10:            this.ProcessDirectoryRecursive(directory1, true);
      11:      }
      12:  }

    Now, why this is done this way and not with the standard buildProvider config section is still a mystery. My guess is that it has to do with the config that it is compiling exisitng in the web.config file. Which is a minor detail that I wish was differnet in the ProfileProvider stuff. I would have rather had a .profile file in the App_Code folder. Oh well not that big of a deal.

  • Windows graphics system to be overhauled post Vista

    I just found this interesting article on some of the limitations in WDDM 1.0. Looks like most of the issues are around GPU multitaksing where generation 1 will be mostly cooperative multitasking. With some hardware improvements and subsequent software releases things will become more pre-emptive.

    Man, how long is it until we are running a complete 2nd computer + OS on our video cards? Will we see display devices in the future that build in the gfx hardware? So you just plug all 9 of your monitors into a highspeed serial cmd bus (USB9) and let the parts of your "computing grid" that are doing general program execution send their display commands to any remotly connected display. The future is bright friends. Just wish it was here now.

  • See Windows Vista

    Just came across Looks like MS has put up a collection of videos to show off Vista. It's pretty funny seeing Tom Skerritt introducing the demos. If you just sit on the home page for a bit and dont click anything he starts nagging you. :)

    Most of the demos seem really geared towards business  and all are using WPF heavily. The virtual books from the British library look really cool even if it does harken back to the Saturday Night Live sketch. Go on over and take a sip of the kool-aid.

  • Windows Live OneCare is finally out...

    Nice to see that OnCare has made it out into the wild. I was on the beta for OneCare and found it to be very usable. I've used Norton AV and McAfee virus scanners in the past. I really have not liked the 3rd party antivirus apps because they eat up alot of resources and cause compatibility issues. OneCare seemed to play nice and I didnt notice any system degradation while using it. If your still riding bare back I highly suggest you try out OneCare.

    P.S. another really nice light weight virus scanner is portable clamwin. It's free and can run from your usb thumb drive. Good for those times when you have to play IT guy for your family or friends. :)