connect four (game)

nospam.Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Nov 26 19:08:00 EST 2017


Chris Angelico wrote:

> On Mon, Nov 27, 2017 at 1:11 AM, bartc <bc at freeuk.com> wrote:
 >
>>If I had to bother with such systematic tests as you suggest, and finish and
>>sign off everything before proceeding further, then nothing would ever get
>>done. (Maybe it's viable if working from an exacting specification that
>>someone else has already worked out.)
>
> I wonder whether you're somehow special in that
> testing fundamentally doesn't work for you, or that you actually don't
> need to write tests.

I think the point is that a strict test-first discipline goes against the grain
 of exploratory programming.

When you're not sure how to approach a problem, it's useful to be able to
quickly try things out. If you have to write a bunch of tests for every little
thing before you can write the code for it, you can end up writing a lot of
tests for code that never ends up getting used. That's a good way to kill all
your enthusiasm for a project.

Also, stopping to write tests all the time interrupts your flow of thought.
You're deep into details of the solution, you realise you need class X, then
you have to stop and write tests for X. That makes you think a lot about all
the details of X, and by the time you're finished you've lost track of the big
picture.

I don't think anyone disputes that having a reasonably complete set of tests is
 a good thing. The argument is about whether it's strictly necessary to write
the tests
*first* in all cases.

Maybe you find it's a useful discipline that helps ensure the tests get
written. That's fine, but it doesn't mean that
*everyone* should be forced to do it that way all the time,
even if they're just programming for a hobby. That's confusing the desired end
result with a particular means of achieving it.

--
Greg




More information about the Python-list mailing list