Whenever I start a new project I like to really think about what it is I'm going to be building. In this article I will show you what that process looks like.
This article is the second in the Introduction to TDD series in which we will build the logic for the game Tic Tac Toe using TDD.
Most of my brainstorming is done on old school pen and paper. I will just make notes and draw sketches, or do whatever I think is necessary to help me understand what I'll be building.
After all the drawing, sketching and note-taking it's time to define our requirements. Since this is a game we could see it as the game's rules. So what are the rules of Tic Tac Toe?
- The game is played with two players.
- The game is played on a three-by-three grid (starts out empty).
- Players, in turn, claim a field by marking it (usually 'X' for player 1 and 'O' for player 2).
- The game ends in a win for the player that first claims three fields in a row (vertical, horizontal or diagonal).
- The game ends in a draw when all fields have been claimed without a winner.
These are the rules we eventually have to translate into code. We can go into more detail, but I'll come back to that once we start implementing these rules.
Don't forget to add the requirements to your favorite project management tool! (not kidding, more on this in a future article)
We now have a clear understanding of what we're going to build. We've listed the rules that we need to cover for our project and put them in our favorite project management tool (still not kidding).
In the next part of the series we will start with creating our project and think about the interface for our package.
Next article: Setting up our project