Part 2. Testing and refactoring
Object-oriented programming and design may seem theoretical and hard to follow. In part 2 of this book, we get to the techniques that will help make them clearer in practice. Unit testing and refactoring (improving the design of existing code) are ways to improve the quality of software, making it easier to maintain and allowing us to prevent bugs. This makes a programmer’s job easier and saves time in dreary debugging. Just as important, test-driven development and refactoring are a unique learning process that let you discover the difference between good and poor application design on your own.
Testing and refactoring are related subjects, since refactoring depends on full test coverage. We will study unit testing to test an application piece by piece. We will use a test-first approach, applying it to an example that will evolve into a simple, but working web application. We will also see how to test this application from the outside using web tests. And we will take a tour of refactoring, looking both at well-known refactorings and some web-specific techniques.