Live data from Hacker News

Test Driven Development? You've got to be kidding me...

writemoretests.com

11–20 of 51 posts

Re: Test Driven Development? You've got to be kidding me...

#11
Still, starting with testing helps so much to create modular design because it forces you to write clear/clean interfaces between them.

My workflow is usually:

  1. Write the tests and design the module/class/whatever in the same time.
  2. Code it. (Repeat)
Although, I rarely write unit tests in TDD; only tests providing a high level design view (Such as functional or integration tests).

Re: Test Driven Development? You've got to be kidding me...

#12
post #11

Still, starting with testing helps so much to create modular design because it forces you to write clear/clean interfaces between them. My workflow is usually: 1. Write the tests and design the module/class/whatever in the same time. 2. Code it. (Repeat) Although, I rarely write unit tests in TDD; only tests providing a high level design view (Such as functional or integration tests).

And perhaps I didn't make my points clearly enough in the article; I was really trying to differentiate between the Test-Driven Development dogma as a panacea for all development problems ever, and developers writing tests first where it makes sense to do that.

Re: Test Driven Development? You've got to be kidding me...

#13
post #2

I am hoping for a more detailed discussions on which case writing test first hinders productivity. Being dogmatic and using One True Approach for everything is not good, but if we were to advance ourselves, we need to be able to define what is good and what is bad specifically. Then, fruitful discussion can follows. Blanket accusation like this would not help no one and is just crying for attention, IMO.

My experience is as follows.

1) TDD encourages testing the smallest unit of functionality possible

2) When you are first developing a large piece of functionality from scratch, you often need to upend the entire architecture a few times as you solidify the design. Theses revamps are the type of thing cannot be done incrementally as large number of small changes. And doing design on paper in advance only goes so far. And these architectural revamps are best done early, as they are far easier to do when you have 1000 lines of code than when you have 100000 lines of code.

3) smallest-unit-of-functionality tests generally get throw away in system-wide revamps

4) Therefore, the cost of these high-level revamps is greatly increased if you need to throw away all these tests every time, hindering productivity.

5) Because of that, I write tests afterwards, once i am comfortable the architecture has stabilized.

TDD is an methodology, not a religion. Do what works best for you and the specific project you are working on.

Re: Test Driven Development? You've got to be kidding me...

#14
There is something ironic about an article that begins: When I hear someone start advocating Test-Driven Development as the One True Programming Methodology, that's a red flag, and I start to assume you're either a shitty (or inexperienced) programmer, and carries on to say that The whole concept of Test-Driven Development is hocus, and embracing it as your philosophy, criminal.

To summarize, the author seems to have the One True Programmer Evaluation Methodology, and is able to determine that someone is shitty, inexperienced, or a criminal from their answer to a single question. How is this different from someone who says that they can determine whether your project is shitty from the answer to the question “Do you use TDD?”

My feeling is that the author has a great deal in common with people who say that X is the One True Programming Methodology, for any value of X, including TDD.

Re: Test Driven Development? You've got to be kidding me...

#15

There is something ironic about an article that begins: When I hear someone start advocating Test-Driven Development as the One True Programming Methodology, that's a red flag, and I start to assume you're either a shitty (or inexperienced) programmer, and carries on to say that The whole concept of Test-Driven Development is hocus, and embracing it as your philosophy, criminal. To summarize, the author seems to have…

I'll be honest and say the article started with the most inane troll about people who run their own mail servers and have beards, and was quickly changed when I realized people weren't reading beyond that ;-) Clearly my sense of humour needs work!

Re: Test Driven Development? You've got to be kidding me...

#16

There is something ironic about an article that begins: When I hear someone start advocating Test-Driven Development as the One True Programming Methodology, that's a red flag, and I start to assume you're either a shitty (or inexperienced) programmer, and carries on to say that The whole concept of Test-Driven Development is hocus, and embracing it as your philosophy, criminal. To summarize, the author seems to have…

I'll be honest and say the article started with the most inane troll about people who run their own mail servers and have beards, and was quickly changed when I realized people weren't reading beyond that ;-) Clearly my sense of humour needs work!

[deleted]

Re: Test Driven Development? You've got to be kidding me...

#17
post #9
post #2

I am hoping for a more detailed discussions on which case writing test first hinders productivity. Being dogmatic and using One True Approach for everything is not good, but if we were to advance ourselves, we need to be able to define what is good and what is bad specifically. Then, fruitful discussion can follows. Blanket accusation like this would not help no one and is just crying for attention, IMO.

These types of posts come up every so often, and I don't really understand why. Sure, the main point is valid (for some people). I just don't understand the vitriol behind the Author's post. So what if someone thinks TDD is the bees-knees? So what if they think less of YOU because you don't drink the same kool-aide? The author won't convince any TDD disciples to change their ways by attacking them. A reasoned post th…

I appreciate the article may be a little polemic for some tastes, but you know, I have often had my mind changed in this way before. I've read something deliberately somewhat provocative, which enraged me briefly, but got me thinking, and a week later, I realized had gotten me thinking enough that I'd started to come around to a different perspective.

Thanks for the feedback. The next article planned is a detailed discussion of how to retro-fit an automated test-suite to a web-app that doesn't already have one.

Re: Test Driven Development? You've got to be kidding me...

#18
"Even if you write only some tests first, if you want to do it meaningfully, then you either need to zoom down in to tiny bits of functionality first in order to be able to write those tests, or you write a test that requires most of the software to be finished, or you cheat and fudge it."

I think this guy doesn't understand the concept of mocking and stubbing in your tests.

TDD works great in bottom up development ("zooming down to tiny bits of functionality"), but it also works great in top down via stubbing.

I feel like his complaint isn't against TDD, but about badly written tests. I think we can all agree: Crappy code bad. Nice code good. Both in tests and in production.

Re: Test Driven Development? You've got to be kidding me...

#19
Having responded to the tone elsewhere, I’ll respond to the content here :-)

The article presents a straw-man in the form of someone who believes TDD is the One True Way, and then attacks this by suggesting that the purpose of tests is—more or less—to prevent regressions. Given that this is an important thing, and since TDD isn’t really about that, TDD is clearly not the One True Methodology.

Quite honestly, that makes perfect sense to me. Love it or hate it, TDD is a design technique, not a regression prevention technique. Much of TDD is the creation of tests that validate an implementation, not a requirement. Thus, changing the implementation breaks the tests and you have to fix them. In that sense, the tests TDD produces are useful after the fact in the same way that Design By Contract’s contracts are useful after the fact. And if Design By Contract wasn’t somebody’s trade mark, I would honestly say that TDD is a way of practising DBC when you don’t have a language like Eiffel handy.

Is Design By Contract a useful technique? I think so. Is it the only technique to use? No. Are implementation tests the only tests needed in a project? No. Are the useful? Yes. Do they impose a maintenance overhead? Absolutely. Are there other paths to success? Absolutely.

So in summary, if I take the article at its face value of railing against TDD being the ONLY methodology, I agree. It isn’t. It isn’t even the only testing methodology. However, the TDD baby is staying right here while I toss out the fanaticism bath water. I believe that TDD is a useful tool and that one way to think about it is as a form of Design by Contract at the implementation level.

Re: Test Driven Development? You've got to be kidding me...

#20
Discussions about TDD always make me think of Ron Jeffries' attempt to develop a sudoku-solver using TDD.

That attempt is discussed in Ravi's article: http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-s...

Peter Norvig wrote a sudoku solver, not by using TDD, but using old-fashioned engineering: http://norvig.com/sudoku.html

Ron Jeffries' attempts:

http://xprogramming.com/articles/sudokumusings/

http://xprogramming.com/articles/oksudoku/

http://xprogramming.com/articles/sudoku2

http://xprogramming.com/articles/sudoku4

http://xprogramming.com/articles/sudoku5

And, as dessert (Ron is very frank about his failures):

http://xprogramming.com/articles/roroncemore/

"This is surely the most ignominious debacle of a project listed on my site, even though others have also not shipped. (Sudoku did not ship and will not. [...])"

Post reply on HN