3 ms·
When I've been serious about testing I'll usually: 1. Hack in what I want in some exploratory way 2. Write good tests 3. Delete my hacks from step
by Buttons840 4y ago
When I've been serious about testing I'll usually:
1. Hack in what I want in some exploratory way
2. Write good tests
3. Delete my hacks from step 1, and ensure all my new tests now fail
4. Re-implement what I hacked together in step 1
5. Ensure all tests pass
This allows you to explore while still retaining the benefits of TDD.
- gleenn 4y agoThere's a name for it, it's called a "spike". You write a bunch of exploratory stuff, get the idea right, throw it all away (without even writing tests) and then come back doing TDD.
- majikandy 4y agoNot sure why you got downvotes for this. It is a very effective technique. Since typing speed was never the bottleneck in software development. Throwing away the little bit of code you wrote, it not expensive. And writing it back in with TDD is incredibly efficient.
- Double_a_92 4y agoAlso not sure why you are getting downvoted. We call it "breakthrough", as in piercing though all the layers to connect one simple usecase from front to end. Once we established that that works properly, we think of a way to do it clean and tested for all other usecases. (In the book "the pragmatic programmer" it's called "tracer bullets / code".)