python-novice-inflammation
python-novice-inflammation copied to clipboard
Test-first programming is not TDD
Hi everybody,
I was just reading through Episode 10 and I think that it is really great that "Defensive Programming" and the idea of "Test-first Programming" are taught as one of the first things to new programmers. I also think that the content of the lesson is very much appropriate for the novice programmer targeted.
What I wanted to point out here is about terminology, concretely that what is described under "Test-driven Development" is NOT TDD. While TDD happens to also have a (single!) test before the first functional code, TDD is very much about the incremental design of the unit under testing and heavily relies on the Test-driven development cycle with refactoring on the go as a fundamental principle. It is quite the opposite of (citing the current lesson material here)
- Write a short function for each test.
- Write a range_overlap function that should pass those tests.
- ...
because you should never attempt to "write [...] each test" before writing any functionality itself (when practising TDD). Instead you would ideally write the simplest possible (failing) test, the simplest code to make it pass and then refactor (and that over and over again).
Again, I think that the content is fine. So, I propose to just replace all appearances of "TDD" with something like "Test-first programming" (and then polish it off again to sound nice with the new wording, of course). I will happily provide more concrete suggestions or a pull request for this transformation, if you agree. Alternatively, I could also write something up about actual TDD but from my perspective that is beyond the scope of the material.
Best, Julian