What Is Test Driven Development

Kent Beck, in his book Test-Driven Development: By Example (Addison-Wesley Professional, 2003), defines test-driven development using the following rules:

■ Never write a single line of code unless you have a failing automated test.

a Eliminate duplicagon.

The first rule is straightforward: don't write code without having a failing automated test because the tests embody the requirements that the code must satisfy, as stated in the Introduction. If there is no requirement (that is, test), chere is no need to implement anything. This rule prevents us from implementing functionality that is not tested and not needed in the solution.

The second rule states that no coge should be SuplEcated in the program. Code duplication is the epitome of bad software design; it leads to inconsistency problems and a reduced level of confidence in the program over time as people forget where the duplications are. If there is code duplication, it is the programmer's job to remove it when it is seen. (In hxtreme Pregramming [XP], this rule is called "Once and Only Once!")

0 0

Post a comment