This page looks best with JavaScript enabled

Creating software in two days: Lansing GiveCamp Retrospective

 ·  ☕ 4 min read

At Lansing GiveCamp I was chosen to lead a team tasked with creating a guest registration system for Ronald McDonald House of Mid-Michigan . Ronald McDonald House wanted to get off their current system, paper, to streamline their processes and report on their data. The event started around 7:00PM on Friday and ended with 3:00PM on Sunday. That’s 44 hours.

At first it seemed too simple and I wondered if Microsoft Access wouldn’t have been sufficient for their needs. That is until Jay Harris met with the client/charity and hammered out the Business Requirements. Whew, there were a lot.

Talking over the ERD

Friday night came and we start the project. First, we defined the domain entities. We had no time to lose so with the domain defined Jay started creating business entity classes while I talked with Dave Giard and Eric Vogel more about the system architecture.

With the business entities ready and three developers wanting to get started at once, how do we get everyone productive? There’s no database, no DAL… This is where Inversion of Control paid out nicely. I whipped up some fakes to return some hard-coded objects so the team could consume those until the actual database was ready.

1
2
3
4
5
6
7
8
9
  public class FakeStaffMemberService : IStaffMemberService {
    private List<StaffMember> staffMembers = new List<StaffMember>() {
      new StaffMember() {Id=1, UserName=JSmith, FirstName=John, LastName=Smith, 
        Type=StaffType.Admin},   
    // …
   
    public IList<StaffMember> GetAll() {return _staffMembers; }
    
    // …

Then I told our IoC Container, StructureMap, to return a FakeStaffMemberService whenever an IStaffMemberService was requested. And yes, with proper Inversion of Control and TDD, it doesn’t matter that the database doesn’t exist in your controllers and middle-tier classes, but we had a lot of views and JavaScript to get written so it was important to hit F5 and see our website.

For the Data Access Layer, I grabbed Fluent NHibernate and fumbled getting automapping to do what I wanted. It was one of those situations where I couldn’t tell if I was five minutes or five hours away from getting the thing to work… so I tossed it and went with normal Fluent NHibernate mappings. It was somewhat tedious but a predictable and manageable task. With a Greenfield database, Fluent NHibernate is perfect. Were we dealt existing schema, I would’ve feared a situation arising I couldn’t map with Fluent, but this wasn’t an issue here. Fluent NHibernate makes the mappings strongly typed and trivial/beautiful while providing helpers for testing your mappings . Along with that, I created a “ test ”, set to run explicitly, to create the schema and populate the database. This let us never need to open SQL Server or even think about its existence. In order to persist a new property, we simply had to add it to the mapping and add a line in our integration test for verification. This led to a less than ideal schema but functioning software was our concern. Later, when the dust settled and product was delivered, Eric and I wrote a script to optimize the schema .

This infrastructure allowed us to just rip through code all day Saturday… which was good because we were hindered by multiple power outages, a restocking trip required by myself to replace clothes and toiletries stolen from my car the night before and some fumbling trying to figure out an ASP.NET MVC binder solution.
With an hour and a half to go to our demo, I realized I had well over two hours of work to do. The main feature of our application, recording a patient’s support people and their stays was not going to be complete. I still had to code the binder and the JavaScript to handle multiple support people.

I was sure trying to explain what I needed to someone would be insufficient for them to comprehend and return what I wanted. I started plowing through it, hoping maybe I could come in under the wire when I saw an out. I knew what the Act and Assert was in my Unit Test. I wrote them, checked it in and asked Dennis Burton for an hour of his time to fill out the Arrange part of the test along with the implementation. There were three failing tests and I needed them all to be green. He downloaded the project and because of our use of Inversion of Control he did not need to set up the database or know anything about the rest of the domain. An hour later he checked in the code and because all of the tests passed I didn’t even care about looking at his implementation. Dropping it into the project was the missing piece and we were done with about fifteen minutes to spare.

Presentation

Photos by David Giard High-Quality Photography

Share on

Leonard Smith
WRITTEN BY
Leonard Smith
Software Forger/Forager