“Pick a little, talk a little, pick a little, talk a little, pick, pick, pick, talk a lot, pick a little more.”
from Meredith Wilson’s musical, The Music Man!
If we replace “pick” with “test” and “talk” with “code,” the song captures the essence of Test-Driven Development: write tests and code in small, incremental, alternating steps. A test case is written first, and, in the absence of the corresponding code, the test case fails when executed. Immediately, just enough code is written so that the test case will pass. (Nota bene: “pass” means the observed outputs are consistent with the expected outputs.) As code size increases, refactoring is permitted, but all the original tests must still pass (otherwise the ...