TDD: Red, Green and What?
The “refactor” step in Test-Driven Development (TDD) is deceptively simple: you just have to improve the code, without changing what it does, right? And the experts make it look so easy: “Look”, they say, “here’s some duplication, which I will remove by “insert magic incantation here”. But how should you decide which “duplication” to remove first? What happens if you fix the “wrong” smell? And how do you even see that duplication in the first place?