Friday finking: TDD and EAFP

boB Stepp robertvstepp at gmail.com
Mon Nov 18 23:05:28 EST 2019


On Mon, Nov 18, 2019 at 3:23 PM Peter J. Holzer <hjp-python at hjp.at> wrote:
>
> I don't know what "proper" TDD is (and even less "proper consideration"
> of TDD), but TDD is in my opinion very much rooted in the agile mindset.
> And that means frequent iteration and improvement. So I think the
> micro-iteration technique is closer to philosophically pure TDD (if such
> a thing exists) than your waterfally "write complete spec, then write
> all tests, then write code" technique (That doesn't mean that your
> technique is bad - it's just not what I think people are talking about
> when they say "TDD").
 Your comments brought to mind a book recommended to me, "Test-Driven
Development by Example" by Kent Beck.  On the intro page to part one,
he says:

"...My goal is for you to see the rhythm of Test-Driven Development
(TDD), which can be summed up as follows.

1.  Quickly add a test.
2.  Run all tests and see the new one fail.
3.  Make a little change.
4.  Run all tests and see them all succeed.
5.  Refactor to remove duplication.

The surprises are likely to include

-- How each test can cover a small increment of functionality
-- How small and ugly the changes can be to make the new tests run
-- How often the tests are run
-- How many teensy-weensy steps make up the refactorings"



-- 
boB


More information about the Python-list mailing list