Skip to content
Scott Smith edited this page May 9, 2014 · 2 revisions

Is TDD Dead?

This was a 1/2 hour discussion on Hangout that included:

  • DHH
  • Kent Beck
  • Martin Fowler

The video can be seen here.

My Takeaway

The 3 participants are in more agreement than disagreement:

  • Automated regression testing is very important.
  • For algorithmic well-bounded challenges, TDD is very effective.
  • May not be as effective for less-understood challenges.
    • Sometimes TDD helps
    • Other times it obscures because new information upsets the developing test structure.
      • This aspect is what gives DHH heartburn; doesn't want to be constrained to TDD when it isn't working for him.
    • Takes skill to determine whether TDD is appropriate choice for you in any programming situation.
  • A lot of what you do is personal preference. TDD is one of many paths to programming "comfort". When it works for you, use it; otherwise don't.

DHH:

Thinks that there are too many rigidities in TDD discussion; too many people are arguing for

  1. Test speed is supreme.
  2. Isolated unit testing (i.e. lots of mocks) emphasis primary in design.
  3. red/green/refactor mandated

He doesn't agree w/ above. Certain cases are good for red/green; other cases he hasn't found useful.

Martin:

In order to understanding something he wants to understand how it came about. TDD helps him to frame where it's coming from.

Beck:

As a child encountered a primitive TDD.

As a trial, he tried TDD "formally" and it worked really well for him.

He has a lot of anxiety on big problems; testing expresses a "chunk" of information that he can then process.

Martin:

At Chrysler was not TDD, but was test complete. I.e. tests came after coding.

Beck:

As a programmer, do you have the "right" to feel confident?

Generally, the industry has not supported this. Beck thinks this is important.

DHH:

Agrees that tests are necessary but TDD generally doesn't work for him. May be a personal style.

red/green/refactor isn't satisfactory for him.

Acknowledges that that is a good experience for others and that it works for others.

He has a hard time writing a test for it if he can't visualize it.

"TDD is one path to having comfort. It isn't the only path."

Beck:

On a problem he was solving, he could TDD for the data structure. When he had to feed live data, he couldn't write a test. Essentially he was spiking. And so he hacked at it until he understood what he was working with.

Summary: TDD when the problem is clearly understood. When problem is not clearly understood, tried to reduce feedback loop to get it done other ways:

  • logging
  • identify unknown boundaries

Works from specific to general.

DHH:

Related to Beck that TDD worked really well when the work was "pure".

When the work is unclear, what am I "going to have to give up" to get the work clear?

When the flow is natural, algorithmic, TDD is great.

But when the flow is not natural, not useful to force TDD because it prematurely ossifies the design.

Beck:

Making a design testable comes w/ costs and benefits. Determining the tradeoffs is a skill. Used example of a compiler:

  1. End-to-end testing?
  2. Test it piece by piece?

Is a discoverable process.

If you don't have a good idea for a design, then TDD is a struggle. Sometimes the feedback loop trying sheds light.

Beck doesn't mock very much; implies it's a smell.

Tests returning nested mocks is a smell of bad design. (my comment: violation of Law of Demeter)

Fowler:

DHH damage implies extremely isolated unit testing. That is not necessarily a TDD requirement.

Need self-testing code. One command running the entire test suite is important; Fowler is willing get on "his high horse" and recommend it. TDD is one path to self-testing code.

He also doesn't mock much either.

Misses when the problem he's trying to solve doesn't lend itself to TDD, but that's real life occasionally. Frequently will lead to chunks that are TDD-able.

DHH:

Principle he wants to trumpet is: self-testing code is more important than TDD; not vice-versa.

Ranting against what he thinks everyone defines TDD to be. (Yeah, stop it, we get it)

More important to him: having a design that fits his programming style. For him, tying unit tests to ActiveRecord is a positive, not a negative.

Fowler:

Wants to close the hangout. Proposed a new hangout in which we explore when and how TDD damages design.

Clone this wiki locally