I played with some new software development tools this weekend, TeamCity and Mingle.

TeamCity is a build server by the wonderful folks at JetBrains. It is a package I have wanted to take a look at for a few moons after Roy Oshergrove mentioned it in his blog. Using it this weekend as the build server for GameProject (my XNA adventure!) is the first time that I have put it through its paces. (More accurately I put it through a few baby steps!)

Mingle, is an agile planning & tracking tool by ThoughtWorks and it comes with a year evaluation license for five seats. Again GameProject was my guinea pig. The software at first glance is a bit more than I need as the one guy on the project but it looks shiny nonetheless. The best implementation of “cards” on screen I have seen yet. I shall be sticking to a combination of Google Notebooks and RSS for now.

I decided to draw a line under the Bouncy game this evening. Then I decided to resurrect it and make it the subject of my base project for Windows games. The education section of XNA Creator’s page yielded my next evenings jaunt through the merry fields of XNA; I am going to use the Game State Management example as the inspiration (basis?) for my template project.

The actual game (GameplayScreen.cs) will be where Bouncy lives on!

Star-128x128 Zara Grace is my youngest daughter. She is a bubbly, smiley six month old who loves sitting at daddy’s computer thumping his keyboard. With the release of the XNA Game Studio 3.0 in the last few weeks, I decided to spend my geek time this weekend putting her together a simple “bash the keyboard game.” And low, Bouncy was born!

Bouncy is a very simple 2d “game” which baby can interact with by hitting keys. It represent my first foray into game development with the XNA Framework and I am quite happy with it considering it is about a days worth of effort. For those who are new to XNA or have not tried it out yet, I hope this project will serve as a “quick start.” It demonstrates the rendering of a texture, sound effects and music, some simple physics and the handling of user input.

The binaries and source are available for download at Magoo Games.

This weekend I have been evaluating  Castle’s ActiveRecord as an object relation mapping solution. It is built upon NHibernate and is an implementation of the active record design pattern.

After browsing the quick start documentation and a couple of trips to Google, I had a simple object mapped to a table and was happily completing operations within my applications controller using Castle’s friendly syntax.

My first thoughts have been very positive. I had much less to do in the way of configuration than when using NHibernate on it’s own. This held true for both the general configuration (Indeed, ActiveRecord did not require any alteration of the web.config at all!) and on an object to object basis as mapping is done by the assigning of ActiveRecord attributes to the properties of the corresponding class (No more XML mapping files to maintain.)

Out of the box, Microsoft’s new code analysis tool (Style Cop) did not play with the firmly entrenched ReSharper in my Visual Studio IDE. However, a quick dash to CodePlex yielded a plug-in for ReSharper that had me back in business in minutes.

My first take on Style Cop was that it was a great deal of commenting and a new place for my using directives. Feeling a little affronted by the 199 warnings my ASP.NET MVC spike project generated on the first scan, I changed Studio to treat warnings and errors, made a cup of coffee and set about it.

I am pedantic. My wife is a saint as she lives with me and has yet to seriously hurt me and to my knowledge not on purpose, yet. This trait is either a symptom of my trade or a cause. There is a small amount of shame welling in me as I try to convey to you how much I adored the code I produced in the next couple of hours. It did not do anything different functionally (well some tiny bits) but it looked shiny. It was the type of code that I wish to encounter in projects that I work upon.

Style Cop is a winner with me! I heartily recommend trying it; if you have not already.

The senior technical lead in my department, Barry, has instructed me to add it to our build process. The way he put it, and I paraphrase was “I don’t agree with everything it suggests; but I’ll accept it for the standard of code it enforces others to produce.” I must concur!

If he is aware of just how number of times I end up on martinfowler.com, I am sure the premier Calgarian geek might think I am virtually stalking him.

Today’s foray was to find out more about fluent interfaces and method chaining. I have been using Phil Haack’s HttpSimulator quite heavily in the last few days and want APIs that I write to be as easy to use and part of such readable code.

For example:

using (HttpSimulator simulator = new HttpSimulator())
{
  simulator
   .SetFormVariable("Test1", "Value1")
   .SetFormVariable("Test2", "Value2")
   .SimulateRequest(new Uri("http://localhost/Test.aspx"));
}

Today whilst writing some tests utilising some legacy code (Legacy code is any code without tests!), I encountered a null reference exception as references to the HttpContext have made it into the business layer I was using. No IIS … No HttpContext … Thanks to Jason Bock and his wonderful article I will be back in business tomorrow!

I was sold after I added the following test to his tests. The cache object in particular was something I wanted to “mock”.


[TestMethod]
public void UseCache()
{
  HttpContext context = (new MockHttpContext(false)).Context;
  context.Cache.Add("test", "test value", null, DateTime.Now.AddMinutes(1),
    TimeSpan.Zero, CacheItemPriority.Normal,null);
  Assert.AreEqual(context.Cache.Get("test").ToString(), "test value");
  Assert.AreEqual(HttpContext.Current.Cache.Get("test").ToString(), "test value");
}

The article is well worth a (re-) read as it is a great “how-to” for using Reflector