¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: [TDD] Extra test needed?


Kent Beck
 

There are two schools on writing tests to force you to replace "10" with
"amount * rate".

The first school I call Triangulation. It predicts that you wait until you
are converting 10 USD at 2:1 and 20 USD at 3:1 before you can have both
variables in the target statement. I do not generally subscribe to this
school, although I can do it if necessary.

The second alternative is FITYMI (Fake it til you make it). This says that
you first create a constant response, then refactor to eliminate duplication
between test case and code.

I've tried Triangulation, but the steps don't seem valuable to me, so I
quickly lose motivation. When using FITYMI I occasionally slip into
premature abstraction, but generally I'm much happier with the steps.

The third alternative is, I suppose, just typing in the correct
implementation from the get go, variables and loops and all. This is kind of
third gear, and is probably what I really do most of the time.

Kent

Join [email protected] to automatically receive all group messages.