Test Driven Development
As much as practical, we should use the SUnit unit testing framework to implement the game model. More than likely we'll not concern ourselves with writing unit tests for the actual behavior of the GUI. But there's plenty we can accomplish by driving our development of the game model from unit tests.
I'm not too attached to how we code the very first few lines of code. An approach I've seen used by many people is to begin with the Unit Tests, even to the point of not having any objects to test before the first test is written. Another approach is to implement some basic model and then drive from that point forward using Unit Tests.
Unit Tests will help us accomplish several things.
- Help us to develop our objects.
- Provide a consistency check as we continue to add code. This helps us to keep from breaking things we've already written that work.
I have found that good unit tests capture your requirements and help you as you implement design. Often, when you write a unit test you are forced to think about your design as if it were finished.
We'll have to do a little more definition in the Squeak development environment before we do anything else. So let's get that out of the way next. Relaunch the Squeak environment if you currently do not have it running. Be sure to choose your previously saved "Squeak.image" file.