|
|
|
|
|
by ignu
1387 days ago
|
|
That's very false in my experience, and I did 100% TDD for years (have a more nuanced approach currently in TypeScript/React) As a programmer with a problem, you first instinct is to start at the solution. TDD pulls you back, and you first have to write the api and decide how you verify it. If you're doing it well, you make both of those things as simple as possible, first. Reduce dependencies and inputs, etc. That's actually the most important part, an easily consumable api that's easy to verify, not the implementation, and TDD forces you to do it first. Also, a pet peeve of mine is seeing a line or more of code that doesn't do anything. With TDD, such detritus is impossible as you can't write production code unless it's making a red test turn green. |
|
TDD has refactoring steps which only have to preserve passing tests; refactoring can easly be the vector that introduces dead code as well as changes behavior for untested input combinations.
I suspect that a lot of code developed TDD is actually deployed on input combinations that are not covered in the TDD test suite.
A string length function developed by TDD will still work on len("supercalifragilisticexpealidocious") even though that exact string never appeared as a test case, and the consumers of that function will use it on all sorts of untested inputs all the time.