views:

487

answers:

6

Both ideas sound very similar to me, but there might be subtle differences or the exact same thing, explained in different ways. What is the relationship between TDD and Test First Development/Programming?

+1  A: 

They are exactly the same thing. Both reference writing tests first, then writing the code that will pass the test

Matt Briggs
+3  A: 

TDD = TFD + Refactoring.

When you do TFD , you apply some refactoring to make code more generic and robust.

I think you've got it - here is a link confirming http://www.agiledata.org/essays/tdd.html
John Sibly
This is, in fact, not true - TFD has always included the refactoring step, too.
Ilja Preuß
+1  A: 

TDD (Test Driven Development) is Test First Development/Programming although I have seen and heard TDD used to mean creating persistent, repeatable unit tests (even after the code), but really it implies the tests are written before the code they are testing.

Jim Anderson
+7  A: 

There's a difference in terms of what the driving factor is.

Do you have a vague idea of what the class (or system - this can happen at different scales, of course) should look like, then think up tests which give it the actual shape? That's TDD.

Do you know exactly what the public API of the class should be, and just write the tests before the implementation? That's test-first development.

My style tends to be a mixture of the two. Sometimes it's obvious what the API should be before writing any tests - in other cases testability really drives the design.

To put it another way, TDD starts with "What questions do I want to ask?" whereas non-TDD (whether test first or not) starts with "What answer do I want to give?"

Jon Skeet
If you look at just the words, this distinction seems to make sense. If you look at the history, you will find out, though, that TFD from the beginning referred to what you describe as TDD. See my answer.
Ilja Preuß
It may have done so historically, but my answer is what I understand the current distinction to be in normal parlance. There's clearly a real differences between the two approaches I've described, and TFD and TDD imply those differences reasonably well, IMO.
Jon Skeet
I guess we just have different experiences with "normal parlance", then. To me, it seems that there is at least a big part of the Agile community to which the names wouldn't imply those differences at all, and it might be valueable to be aware of that.
Ilja Preuß
It's certainly being aware of both sides - that some people will treat the two as synonymous, and some people will see a significant difference.
Jon Skeet
+1  A: 

@Google Ninja

One minor correction/addition: "writing tests first, [writing the test to initially fail], then writing the code that will pass the test"

Jim Anderson
+4  A: 

They are basically different names describing the same thing - well, in fact five names, as the last D can stand for Design as well as for Development.

Test First was the term used originally, especially in the context of Extreme Programming, for the test-code-refactor cycle. The name Test Driven Development has been proposed - and quickly adopted - later, to stress the fact that TFD is - and always has been - more of a design strategy than a testing strategy.

Obviously today some people have different connotations for those two terms, but that wasn't the intent behind their existance, and I wouldn't rely on it being common knowledge (because it's not). In fact, I'd rather see the term TFD as being deprecated.

Ilja Preuß
Ilja gave my answer so I guess I should vote him up. :)
Jeffrey Fredrick
Exact: Kent Beck decided to change the name from TFP to TDD while he was writing "Test Driven Development: by example"
philippe