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.
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.
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.
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.