Chapter 4. Test-Driven Development
Test-driven development (a.k.a. test-first programming) represents an important change to the way most programmers think about writing code. The practice involves writing a test before each new piece of functionality is coded into the system. The preceding chapter hinted at this, with some of the tasks defined as tests. The tests themselves become part of the software. They are written in the same language that the production code is being written in (in this case, C#). This is a new concept for many developers, and they find it hard to move into the mindset of writing test code before they write "production" code. This chapter emphasizes the need to develop high-quality code and guides you through exercises to reinforce the practices. To help you write the tests, you are going to use NUnit, a freely available testing framework for development with the .NET Framework. Before starting with the exercises and writing the tests, first take a step back and think about how doing so can help you with your job.
| What Is Your Job?This is a question I often ask my students. Interestingly, nearly everyone responds in the same way: "programmer," "senior developer," "project manager," or "software engineer." I find this interesting because these are smart guys, and yet they are telling me the title of their job and not their job. So when I clarify and ask them, "Okay, so what do you do in this job," the answers I generally get are "develop software," "write code," and "manage projects." Sometimes I get answers that pertain to the robustness or quality of the code, and occasionally I have a student answer with "to increase the value of the company I work for." When you are developing software or any IP (intellectual property) for a company, you are attempting to increase the value of company through your inventions. The IP is an asset for the company, and the reason they hire you is to build the assets. The value of the asset that you are developing depends in part on its quality. |
|
|