David Findley's Blog
My little home in the cloud.
-
A great article on functional programming...
http://www.defmacro.org/ramblings/fp.html
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:
COmega: http://research.microsoft.com/Comega/
LINQ: http://msdn.microsoft.com/data/ref/linq/
F#: http://research.microsoft.com/fsharp/fsharp.aspx
IronPython: http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython
Ruby: http://www.ruby-lang.org/en/
Ruby.NET: http://www.plas.fit.qut.edu.au/rubynet/
IronRuby: http://wilcoding.xs4all.nl/Wilco/IronRuby.aspx
RubyCLR: http://www.iunknown.com/articles/2006/06/19/rubyclr-drop-4
Atlas: http://atlas.asp.net/Default.aspx?tabid=47
#Smalltalk: http://www.refactory.com/Software/SharpSmalltalk/index.html
brianbec's blog:
http://weblogs.asp.net/brianbec/default.aspx
http://weblogs.asp.net/brianbec/archive/2006/06/01/Lambdas_2C00_-Closures_2C00_-Currying_2C00_-and-All-That.aspx -
Microsoft Product Name Generator
Feel free to customize your own. Here's the srcipt source:
-
Set hardware clock to UTC on Windows (or how to make the clock work on a Mac Book Pro)
I recently bought a Mac Book Pro since I can now dual boot OS X and Windows XP. The only real issue that I've had is that OS X, like most Unices likes to set the hardware clock to UTC time. This causes the clock in Windows XP to be off by 5 hours (I'm in the central US timezone).
-
Microsoft Robotics Studio ?!?
Just ran across this on my daily news rounds:
http://www.eweek.com/article2/0,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: http://weblogs.asp.net/eporter/archive/2006/06/20/Building-Robot-Software-Using-Microsoft-Robotics-Studio.aspx
He's even got links to channel 9 videos.
Resources:
Tech Preview
Channel9 Video
Similar:
RobotC -
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 www.martinfowler.com.
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 asp.net 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 system.net/mailSettings section. I have yet to get it to modify this section. The build will just fail saying that it cant find system.net/mailSettings. 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 Update: Some good ideas here for more advanced scenarios.is a group not a config section as I orginally thought. Once I changed the deployment project to this:
system.net/mailSettings/smtp=mailSettings.config;
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. -
Google Spreadsheets ?!?
http://www.google.com/googlespreadsheets/tour1.html
Here's some videos: http://blog.outer-court.com/archive/2006-06-06-n86.html
Google is about to heat things up again it looks like. Are we ready for the web application wars? -
How the ProfileCommon class gets compiled
Lance and I were puzzling over the magic that happens when you configure the profile provider in asp.net 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 asp.net 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.