Home > General Software Development, Pair Programming > From solo developer to team coder (TDD, C# and Mocks)

From solo developer to team coder (TDD, C# and Mocks)

Pair Programming

December 11th 2008 | Jonathan Cogley

On Monday, 11/24/2008 I did a presentation at the Northern Virginia SQL Server User Group. Shaking too many hands at the Microsoft TechEd tradeshow the week before in Barcelona had given me a nasty case of viral bronchitis so my voice was fading fast. If I could just keep drinking liquids and get a microphone, I would be ok.

The focus of the presentation was code – there would be no slides. The idea was to show real code being written as the Thycotic team would write it. We use Test Driven Development (TDD), Single Responsibility, Dependency Injection and Mocks to make our code single in purpose, easy to follow, and fast to test. We also practice Pair Programming so we get rapid feedback, and review during development.

A quick poll of the audience revealed few people are familiar with TDD and even fewer with Pair Programming. Surprisingly very few individuals were even in the habit of writing any unit tests for their code! The session needed to drop down a notch to make sure we didn’t lose them in the first NUnit test case using mocks. We started out slow, explaining the parts of NUnit and the structure and purpose of a unit test in a simple state-based scenario. Everyone seemed to follow along well and asked thoughtful questions. Gulp my diet coke and take off my microphone to cough…

We then moved in to the first mock-based test. The subject matter dealt with adding a tracking feature to our online store in order to track visitors during their visit and determine their path-to-purchase – a typical business value feature that is critical to marketing folk. This was real code in a real code base so it didn’t smack of academia – it also had some nice external dependencies such as the online store database, existing business objects, and the web environment to track visitors. These all made for great mocks as we isolated those responsibilities outside of the code we were writing.

We spent some time reviewing the requirements (written as a sprint-style story with “As a”, “So that” syntax and conditions of satisfaction). We had missed the essence of one requirement and had to change our test and logic accordingly. The audience once again seemed to follow along well and got the concepts at play. They were very surprised with the structure of the tests and the amount of work done to ensure that the code functioned correctly. Wheeze, cough and thanks to all.

The general sentiment at the user group was that most were getting into code from DBA positions and were looking to improve their programming skills. The techniques demonstrated were more advanced – typical of projects with large teams or multi-year development projects where quality and sustainability are essential.

If you are interested in learning more about TDD, Pair Programming or mock-based development – sign up for our new Agile Training Mailing List – we will be announcing training dates in Washington DC from January 2009 onwards.


Jonathan Cogley is the founder and CEO of Thycotic Software. Test Driven Development (TDD) is the cornerstone of the thycotic approach to software development and the company is committed to innovate TDD on the Microsoft .NET platform with new techniques and tools. Jonathan is an active member in the developer community and speaks regularly at various .NET User Groups, conferences and code camps across the US. Jonathan is recognized by Microsoft as an MVP for C# and has also been invited to join the select group of the ASPInsiders who have interactions with the product teams at Microsoft.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: