Archives / 2009 / August
  • Conway’s Life in WPF

    The “Game of Life” was invented in 1970 by John Conway, a British mathematician.  The rules of the game are simple, but the resulting behavior of the system that results is often surprising and in any event difficult to predict.  There’s a great deal of information available online relating to this game and many implementations of it exist.  I found an article called Life with XAML from 3 years ago by Scott Allen that got me started quickly getting something working in WPF.  I was led to Scott’s article by Mark Betz’s blog, which has a series on his work in this space and which also led me to the Life Lexicon, which describes many of the patterns that exist in these … more

  • Practice, Code Exercises, and Code Katas

    One of the ways we improve as software developers is through practice.  Practice isn’t just something that’s done as you go about your job – it has to be focused on improving your skills.  Practice can take many forms, but two of them include practicing doing something the right way and practicing something new that is outside of your comfort zone.  Often in our day-to-day work, our focus is on delivering something within a given timeframe, and not necessarily on doing it the right way.  Further, without exploration and practice learning new things, we may not be aware of what the “right” way is to accomplish certain tasks.  There are individuals with many years … more

  • Iterators, Expressions, and LINQ for Euler

    Recently I’ve been doing some Project Euler problems as exercises to help improve my coding skills.  We do this internally at NimblePros periodically and also at last weeks Hudson Software Craftsmanship meeting, which I co-run.  In doing these problems, I’ve been trying to approach them both from a traditional C# 1.0 standpoint as well as using newer constructs such as lambda expressions, LINQ, and iterators.  It’s amazing how much more flexible a design can be through the use of these tools. For example, the first Euler problem simply asks that you add together all natural numbers that are multiples of either 3 or 5 and less than 1000.  A simple design of this problem … more

  • Code Review Singleton Pattern Issues

    One of my applications relies on a singleton pattern to create a single instance of a server which processes requests from many different ASP.NET handlers.  It is created using pretty much standard Singleton code:

    public static Context CreateContext()


    return CreateContext(new ConfigurationFileSettings());


    Recently, this server needed to be made aware of whether requests were coming into it via SSL or standard HTTP.  The solution that was checked in (and which worked and passes local tests) is to create a new property of Context called IsSecureConnection, and to allow this to be passed into its public constructor like this:

    public Context(ISettings … more

  • Caching Key Generation Considerations

    Recently I was reviewing some code and ran across this – can you spot the problem? var parameters = new List<SqlParameter> { new SqlParameter("@SomeID", someId), new SqlParameter("@SomeOtherID", someOtherId), new SqlParameter("@ServerDate", serverTime) }; string cacheKey = string.Format("ResultSetName-sid{0}-soid{1}-date{2}", parameters.Select(x => x.Value).ToArray()); var resultSet = Cache[cacheKey] as List<Foo>; if (resultSet == null) { // do … more

  • MSDN Subscription Installer

    As I write this, I’ve just installed Windows 7 on my development/presentation laptop, and it’s currently installing a bunch of apps using the Web Platform Installer.  If you haven’t tried this tool, you should definitely check it out.  It’s free and easy to use and available here.  Basically, instead of hunting around in 15 different places online and on your various CDs or DVDs to install your basic dev platform tools (web server, frameworks, SDKs, etc.), you just check a few boxes in the installer and it downloads and installs everything for you without the need for further interaction.  It’s even smart enough to start installing some apps while it’s still downloading … more

  • Ad Landing Pages and Customer Conversations

    One of Lake Quincy Media’s clients recently wrote to me in response to my previous post about the Principle of Least Surprise and its relationship to online advertising.  Their question revolved around whether it was appropriate in their case to use their company’s home page as the landing page for their advertisements, something they were doing across the board.  I suggested to them that, in my experience, having a dedicated landing page that ties into a specific call to action in the advertisement is the best way to achieve a high response rate.  Removing the names to protect the innocent, here’s my recommendation with regard to optimizing landing pages for online … more