Beginning Wordz
Let’s apply these ideas to our Wordz application. We’re going to start with a class that will contain the core of our application logic, one that represents a word to guess and that can work out the score for a guess.
We begin by creating a unit test class and this immediately puts us into software design mode: what should we call the test? We’ll go with WordTest
, as that outlines the area we want to cover – the word to be guessed.
Typical Java project structures are divided into packages. The production code lives under src/main/java
and the test code is located under src/test/java
. This structure describes how production and test code are equally important parts of the source code, while giving us a way to compile and deploy only the production code. We always ship test code with the production code when we are dealing with source code, but for deployed executables, we only omit the tests. We will also follow the basic Java package...