Re: Paralyzed by TDD



jasongorman wrote:

> Phlip wrote:

> >Could you pick a simpler learner project, like a recursive descent
parser?
>
> Actually, a directed graph is conceptually fairly simple, and should
> lend itself well to practicing TDD - you don't have to worry too much
> about understanding the problem because you can just open a book on
> discrete maths and there it all is, ready made.

That's the problem. It's not simple enough that you can use TDD to learn
what the algorithm can be.

Implementing an algorithm from a book is harder under TDD than inventing a
simple algorithm from scratch.

> The previous replies make sense. Break the problem down by starting
> with the simplest instance you can think of (an empty digraph, for
> example), and then gradually add scenarios until every property of the
> digraph is accounted for. This is the essence of TDD - start simple and
> build up the design gradually with each new test case.

Right. And the early code should look nothing like the book's version of the
algorithm. Refactors should nudge the code closer.

But: Without that book version, early refactors might lead to a design that
inhibits discovering the final algorithm.

TDD is not a perfect system to discover algorithms.

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand


.



Relevant Pages

  • Re: Test-Driven Development
    ... There are good things about TDD that the "roman numeral" example illustrates ... > bad programming environment that TDD helps alleviate, ... It sucks extra as an algorithm generator. ...
    (comp.programming)
  • Re: Test-Driven Development
    ... If you have to code to badly specified requirements that are subject to ... I can take an hour to think about an algorithm; ... Many real-life programming tasks don't require you to come up with ... they require you to make choices, and TDD ...
    (comp.programming)
  • Re: Test-Driven Development (was Re: Career? What languages to learn?)
    ... But I still have some reservations about TDD, ... > that make quicksort superior to bubble sort. ... TDD can force an algorithm to exist, ...
    (comp.programming)
  • Re: XP Requirement Analysis?
    ... If you always pick the steepest path up from your current ... TDD does _not_ find the shortest path to the highest peak. ... it to generate a new algorithm, it is very sensitive to initial conditions. ... for the outer cycle, feature deployments, can continuously deform a project. ...
    (comp.object)
  • Re: wich is faster
    ... Adding to what Phlip said down below: ... > Your choice of algorithm has the greatest influence on performance. ... > interpret a compressed image in a PNG file, use a profiler to identify ... Say that the profiler indicates that routine foo() is taking ...
    (comp.programming)