On 12/5/06, Trans <transfire / gmail.com> wrote:
> I sympthize. I think TDD makes more sense for applications in which the
> general structure of the program is a given. If youre still working on
> the "what's the best API" then you are probably better off just putting
> the TDD on the back burner until you have it mostly worked out. Then
> you can go back and put in tests. I know that TDD concept promotes
> putting the test before the code, and really one should strive to do so
> (I don;t do it enough myself) but that doesn't mean you always have to
> do so. Really, the most important thing is that you end up with tests.

The problem with this approach is that when you go back to try and add
the tests, you realize your code is not test-friendly and testing is
much harder then it should be.  I'd imagine this is more a problem in
less flexible languages then Ruby, but TDD/BDD definitely drive a
certain simple, testable design that you don't arrive at otherwise.

I think a good api can be developed using TDD, and in fact looking at
the tests used to create an api is one of the best ways to learn it.

- Rob