Wordz Design Evaluation and Optimization
Explore test-driven development techniques to evaluate and optimize the Wordz game design. Learn to handle boundary conditions like game over detection, implement effective error reporting, and perform strategic refactoring. Understand how to improve code readability and maintainability while ensuring comprehensive test coverage for core game logic.
We'll cover the following...
It’s time to add some boundary condition tests and double-check our logic.
Handling guesses after game over
We need a couple more tests around the boundary conditions of the game over detection. The first one drives out the response to an incorrect guess being submitted after a correct guess:
There are a couple of design decisions captured in this test:
Once the game ends, we record this in a new field,
isGameOver, in theGameclass.This new field will need to be set whenever the game ends. We’ll need more tests to drive that behavior out.
We’ll use a simple error-reporting mechanism—a new field,
isError, in theGuessResultclass.
This leads to a bit of automated refactoring to add the ...