Re: TDD for numerical algorithms

Adam Sroka <[email protected]> Thu, 27 May 2010 12:49:22 -0700
Newsgroups gmane.comp.programming.refactoring
Message-ID <[email protected]>
On Thu, May 27, 2010 at 7:22 AM, Ron Jeffries <[email protected]> wrote:
> Hello, George.  On Thursday, May 27, 2010, at 9:49:53 AM, you
> wrote:
>
>> 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.
>
> I'm not at all sure that this distinction is crisp, nor that it
> should be. It seems to me that writing tests first is a very nuanced
> practice, not one that has hard lines in it saying over here it's TF
> and over here it's TD.
>
> I suspect that as wrong-brain thinkers we have a tendency to want to
> nail down the clouds.
>

Thinking about it, I am coming around to that view.

I often use the tests as a way to challenge myself to prove that I
need the things I'm pretty sure I want. I think that that *is* TDD, or
at least it could be.

But, I'm also pretty sure that doing this wouldn't lead me to
something as complex as a Mersenne Twister. I would need to go a few
steps further in my assumptions and get a bit more intimate with my
implementation in the tests.

It's somewhat of a fine line, but I think the key is that the tests
are written from the perspective of a client using the interface. So,
if my tests know about sets and set operations, that might be a bit of
a smell, but it's one I can maybe live with for a while until I start
to get the implementation I want, then I can refactor it away.

On the other hand, if I need my tests to know about things like
looping constructs and magic number seeds, then I have gone a few
steps too far into something that is not like OO. But, maybe that's
okay in some circumstances...


------------------------------------

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/