Test first, ask questions later. I
finally get Test First! Finally.. I've been struggling with it for a
while. Why? - because you don't know what it is you want to make before
you start making it. Heck, even if you know the API you still don't
know how it's going to actually look. Why waste your time with tests
you're going to have to re-write anyway.
Well, the answer is surprisingly obvious. You have to experiment to
write the code any way, right? - Often we do this in a workspace, or in
a new class because we have a class name we like, or we do it in an
inspector. Don't. Do it in a test case. If you do it in a test case, if
it works out you can refactor it in to code+tests. Doing it this way
allows you to experiment and grow. If you publish often, it also lets
people see how you evolved the code. Test cases have become my birthing
grounds for new code! [Michael Lucas-Smith]
I have made the same discovery in the
last few weeks. After reading Kent Beck's book on Test-Driven
Development I finally got it., test first!
7:32:58 AM
|
|