Kata #5: Full project

Objective: You've been practising TDD in unit level. In this kata, you are to apply it in full scale to a mini project that involves more than one layer of architecture.

The task

You are to develop a TicTacToe game. You can write it as an Android app, an iOS app, or a web service, depending on the platform you are specialised in.

What to do and where to start: You should break the problem into user stories. Make a to-do-list of them. Then use automated end-to-end acceptance tests to drive your code from outside in. Use TDD to implement each feature.

For details of the process. Please refer to "Growing Object-Oriented Software, Guided By Tests". Chapters 9-11 can help you with iteration zero - how you can kick off the TDD process. Chapters 12-14 are about iteration one on - how you TDD to pass an acceptance test, how you can pull out the detailed design in the process. Those are just the minimum to get you started. You should benefit from reading the whole book.

The TicTacToe Game

Creating a nice user-friendly application is out of the scope of this kata. The game should provide only a minimal user interface, just enough for user to issue commands like "start new game", "end current game", and "select a move" and to see the current status of the game. That means it is just enough for end-to-end tests to interact with the app from outside.

Suppose we denote board cells as following:
123
456
789

Below is a sample scenario, in which a human tester can use one UI to play the roles of both players:

  1. Start the app.
  2. The app gives two choices: a new game with x first or a new game with o first.
  3. User starts a new game with x as the first player's symbol.
  4. App promts for the first move
  5. User selects cell 1.
  6. App registers an x move at cell 1 and promts for next move.
  7. User selects cell 2.
  8. App registers an o move at cell 2 and promts for next move.
  9. User selects cell 5.
  10. App registers an x move at cell 5 and promts for next move.
  11. User selects cell 3.
  12. App registers an o move at cell 3 and promts for next move.
  13. User selects cell 9.
  14. App registers an x move at cell 9, declares that x has won, and prompts for a new game.
  15. User starts a new game with o as the first player's symbol.
  16. App promts for the first move
  17. User selects cell 5.
  18. App registers an o move at cell 5 and promts for next move.
  19. But the user has got too bored, he ends the game.
  20. The app gives two choices: a new game with x first or a new game with o first.
  21. The user instead chooses to see the hall of fame.
  22. The app displays a list of games that have been played so far, sorted in the descending order of time. The first row is x 12539 x, which means x won, the moves were 1,2,5,3,9 and in that order, and x was the first player.
  23. The user then shuts the app off.