Re:An External Replication on the Effects of Test-driven Dev...
by crdoconnor on Wednesday October 19, 2016 @05:04AM
(#12742243)
I usually don't do unit test driven development actually. I typically do integration test driven development where the integration test sets up an environment where the code is either interacting with the real thing or a realistic mock version.
I don't find unit tests all that useful for integration code - either as tests that find bugs or for doing TDD.
How do you know you made API mistakes from writing unit tests ? API mistakes become apparent when you integrate stuff and use the API in conjunction with other things (using API in isolated scenarios like unit tests is not really insightful you can figure out those flaws just by looking at the API). This is my primary criticism of TDD - you write tests around the initial bad API and you end up keeping that bad design because you already spent so much time testing that. Implementation errors caught by unit tests are cheaper to fix afterwards then design errors.
My approach is hack together a POC -> refactor that and write tests. If you discard the POC then TDD makes sense to me.