The TicTacToe Kata in C# – A TestDriven approach

This is for my future self to see how I look like on camera while coding ;-)
And I am doing another experiment to see if people are interested in this kind of stuff.

I turned on Camtasia and recorded myself during my weekly practice sessions. Published on youtube and now I wait and see what the reactions are.
Tools used: mstest, VisualStudio 2012, Resharper and Notepad.

The TicTacToe Kata in CSharp
Figure: Is the font big enough? Is my picture small enough? Is my voice annoying enough? Let me know!

The TicTacToe Kata

A simulation of the TicTacToe game, where 2 players can play Tic-Tac-Toe against each other.

Goal of a Kata session (straight from Kata martial arts):

  • preserve and transmit proven techniques and to
  • practice

For me its not so much about proven techniques, but more about practicing and exploring new languages, frameworks and tools.

 

Video 1/4    (7 minutes)

Starting the Kata with a test written in Notepad and then slowly building the 1st test by example.
I use the inconclusive Assert.Inconclusive() tests as my TODO list.

 

Video 2/4    (21 minutes)

In this video I start with 1 passing test and 2 inconclusive tests.
Tests drive my implementation and slowly I build up the API of the game.
Making my tests more specific helps me maintain them. And I discover that previous tests have value. Wow!
I have 3 failing tests and 4 passing tests at the end, just got stuck With with extracting the “GameBoard” class.

  

Video 3/4    (15 minutes)

In this video I fix the bug (1 red test) with which I got stuck with the previously. I continue to drive out the implementation of the “GameBoard” and implement more and more game rules.

 

Video 4/4    (12 minutes)

In this video I have the Game logic working to identify winners in a row.
Time to finish up all the game rules!

 

Now its up to you:

  • What did you like in the video series?
  • What didn’t you like?
  • What could I improve?

Latest Posts

Popular Posts