Re: TDD for numerical algorithms
George Dinwiddie <[email protected]> Thu, 27 May 2010 09:49:53 -0400
| Newsgroups | gmane.comp.programming.refactoring |
|---|---|
| Organization | iDIA Computing, LLC |
| Message-ID | <[email protected]> |
Adam,
Adam Sroka wrote:
> That's a nice distinction, and I would put it similarly. It is a form
> of Test First, but it is not TDD.
>
> I have done that before, but it is not usual for me. I generally
> ignore algorithm design preferring to focus on the business problem
> exclusively until I have some performance need that compels me to
> optimize. Then I would use a profiler to find bottlenecks, write some
> performance tests around those bottlenecks, and optimize them until
> the performance tests passed consistently.
Optimization is not the only reason to choose a particular algorithm.
In the morning session in Floyd, I co-TDDed three different approaches
to Conway's Game of Life. One started with the concept of Cell, one
with Board, and one with Relationship. Each of these starting points
lead towards very different designs, and each made me think about the
nature of the problem in different ways.
During the lunch break, Hill, John Maxwell and I discussed an idea Hill
had about using sets to implement the game. To Hill's consternation (he
didn't get to explore his idea), I worked on a Test First implementation
using that algorithm. I knew what sets and set operations I needed to
make it work. I test-drove using those preconceived assumptions, but
trying to avoid non-essential assumptions surrounding them.
It really was quite a marvelous exercise. It was, by far, the best
technical approach I tried. I could see that it could handle any
arbitrary number of dimensions, and could even handle a non-transitive
definition of "next to" (such as you might get with a one-way street).
But it was not a TDD of the algorithm. It was a TFD of the algorithm,
where the tests provided the minimum necessary to support the
algorithm's operation.
- George
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/refactoring/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/refactoring/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/