Quantcast
Channel: refactoring Archives - XP123
Viewing all articles
Browse latest Browse all 42

Refactoring and Generalization in TDD

$
0
0

This article (originally published in Better Software) explores generalization in TDD.

The basic notion is that refactoring sets out to not change the behavior of code for any of its inputs, but TDD sets out to change behavior (in the “code” step). The moves we make in TDD are transformations, but they only preserve behavior for some inputs.

For example, suppose you’re writing code to handle Roman numerals. Perhaps you start from the I = one test but at some point you add support for IV or V: you change the behavior for some strings (IV or V) but not others (I).

Get the article here (PDF).

The post Refactoring and Generalization in TDD appeared first on XP123.


Viewing all articles
Browse latest Browse all 42

Trending Articles