Live data from Hacker News

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

writemoretests.com

31–40 of 51 posts

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

#31

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 mak…

It's not a straw-man argument. I've seen countless developers and managers who believe... well, pretty much they believe that unless you're in love with TDD you suck as a programmer, period. This arrogant attitude is very real. In fact, it's commonplace.

Conversely, some people believe that anything that is a direct result of adhering to TDD is automatically well designed, regardless of other metrics.

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

#32
post #26

Earlier quoted context omitted.

Straw man? Where I work about half the developers believe that TDD is the One True Way. Unfortunately, this includes the CTO, who wants to force every developer to practice TDD. (along with other 'agile' methods) When I've worked on something in the early stages of design with someone who has used TDD (for example, if someone junior asks for help designing their project), I end up having to throw out or rewrite major…

Straw man? Where I work about half the developers believe that TDD is the One True Way. Unfortunately, this includes the CTO, who wants to force every developer to practice TDD. (along with other 'agile' methods) I’m sorry that you are frustrated with your work environment, however we seem to have a misunderstanding about the form of the OP’s original argument. If you read it as: (a) There exist TDD OneTrueMethodolog…

I read it as the first form. I was trying to offer at least one example of why I do not think TDD is the OTM. I read the criminal part of the OP as hyperbole. The article does say there are uses for TDD, (not sure how to do quotes on HN)

"Writing tests first as a tool to be deployed where it works is "Developer Driven Testing" - focusing on making the developer more productive by choosing the right tool for the job. Generalizing a bunch of testing rules and saying This Is The One True Way Even When It Isn't - that's not right."

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

#33
post #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://xprog…

"Old-fashioned engineering vs. TDD" is misleading. The difference is that Norvig knew in advance how to solve the problem - constraint propagation - while Jeffries presumably did not.

Suppose Norvig had used TDD while writing his solver. He would have used constraint propagation and come up with a good solution that way too. Similarly, any other technique would have yielded just as poor a result for Jeffries. Knowing things in advance is not a technique. Norvig made this point in Coders At Work:

I think test-driven design is great. I do that a lot more than I used to do. But you can test all you want and if you don’t know how to approach the problem, you’re not going to get a solution.

The important question is: how can you benefit from existing techniques (like constraint propagation) that reduce your hard problem to an easy one if you don't know about them to begin with? It is a genuine conundrum. Norvig gives a very non-technical answer in Coders At Work: general education and intuition. To that list I suppose one could add: asking around. What you don't know about, other people may.

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

#34
post #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://xprog…

I don't know how much TDD matters here. I read 2 articles, and it looks like he doesn't really know how to write a sudoku solver. Unless he was going to invest some time in learning constraint propagation and backtracking, writing or not writing tests would have ended up in the same state.

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

#35
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.

>And perhaps I didn't make my points clearly enough in the article

You made them more than clear. People just want to argue the headline. Good post BTW I'm subscribing to your RSS feed.

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

#36

Earlier quoted context omitted.

"Posted by Peter Sergeant at 02:30"

Yeah, so you don't have a blog, yet you have opinion :). You can down-vote all you want, only thing your post shows is that you are struggling with test driven development. You should learn it well, and then you will be in position to say what part you don't think is useful. And to be constructive, I would suggest instead of trying with unit tests, maybe go with integration testing first and just do that initially, y…

This is awfully generic. Almost a template.

"You can down-vote all you want, only thing your post shows is that you are struggling with insert development practice here development. You should learn it well, and then you will be in position to say what part you don't think is useful."

The blog post, on the other hand, is not generic. I've had similar experiences: in many cases TDD makes trivial coding issues influence overall application design (in a bad way) instead of application design driving those trivial decisions. I can even tell you when this happens. It happens when the complexity in the application comes mainly from structuring large chunks of mostly trivial functionality. I've had pretty positive TDD experience with other type of applications - ones where complexity comes mainly from some data-processing algorithms, while the overall structure of the app is fairly simple. (Think web app vs language parser.)

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

#37
post #33
post #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://xprog…

"Old-fashioned engineering vs. TDD" is misleading. The difference is that Norvig knew in advance how to solve the problem - constraint propagation - while Jeffries presumably did not. Suppose Norvig had used TDD while writing his solver. He would have used constraint propagation and come up with a good solution that way too. Similarly, any other technique would have yielded just as poor a result for Jeffries. Knowing…

TDD seems to encourage you to dive straight into implementation. For certain problems - e.g. a Sudoku solver - it's much more effective to think through the entire algorithm before starting to write code, and I think that the above debacle supports this argument.

You don't exactly need to know any formal theory of constraint propagation to solve this, after all - I wrote a Sudoku solver many years ago based on the algorithm "place a random valid value in the cell with the least valid values; cross off any now-impossible values in the same row/column/block; backtrack if there are no valid moves" which is not impossible to come up with on the spot. (I did.)

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

#38

Earlier quoted context omitted.

"Posted by Peter Sergeant at 02:30"

Yeah, so you don't have a blog, yet you have opinion :). You can down-vote all you want, only thing your post shows is that you are struggling with test driven development. You should learn it well, and then you will be in position to say what part you don't think is useful. And to be constructive, I would suggest instead of trying with unit tests, maybe go with integration testing first and just do that initially, y…

I would like to respond to comments to this post. It is not generic, it is how mind works. If it is hard, it starts finding excuses. Once you master it better, suddenly excuses are gone. I read the post and it doesn't sway me one bit in my view. More experienced developers usually say that they find some part of the testing more useful, while other level is more tedious and they don't feel it is as useful. Consultants use TDD because it gives more predictable results. There are cases when you need to do spike first to discover how to go about a problem, which doesn't say you don't test, just do that when it is appropriate. I think what you suggest as an example is that. Also, I don't believe that you should write tests every time, sometimes if you are a startup and want to do quick and dirty prototype, I don't think it is a bad idea to skip testing, but again, this is not to say startup don't do testing, they are the one who need it more then most, just you should be flexible in your approach to coding and software development.

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

#39
post #33

Earlier quoted context omitted.

"Old-fashioned engineering vs. TDD" is misleading. The difference is that Norvig knew in advance how to solve the problem - constraint propagation - while Jeffries presumably did not. Suppose Norvig had used TDD while writing his solver. He would have used constraint propagation and come up with a good solution that way too. Similarly, any other technique would have yielded just as poor a result for Jeffries. Knowing…

TDD seems to encourage you to dive straight into implementation. For certain problems - e.g. a Sudoku solver - it's much more effective to think through the entire algorithm before starting to write code, and I think that the above debacle supports this argument. You don't exactly need to know any formal theory of constraint propagation to solve this, after all - I wrote a Sudoku solver many years ago based on the al…

I agree that there is a serious criticism here, and that sufficiently deep thinking is underrated.

TDD advocates tend to assume that you can always iterate your way to a solution. But what you get by iteration is sensitive to how you start. Technically, yes, you can evolve any program A into any other program B, but in practice no: the class of programs that A will evolve into is sharply constrained by A. I think this is true no matter how small A is. If that's correct, then initial conditions are a lot more important than it's fashionable to think they are.

Still, this isn't a weakness of TDD per se, but of iterative approaches in general, and it's something that advocates for iterative development of software (and other things) haven't yet taken into account. That's understandable, because the advent of iterative approaches was so necessary and has proven so valuable in other ways. These things come in historical waves.

A point about the Sudoku "debacle", though. The posts by Ron Jeffries are indicative of something other than TDD. They're indicative of mucking around in public. The difference isn't that other people don't make embarrassing mistakes; it's that they hide them. Why would Jeffries exhibit his so blatantly? If he were just a bad programmer or a zealot or a dishonest guru, obviously he'd have suppressed them. Not one of those types is ever too dumb to do that. (Typically, they're quite good at it. Maybe that's where their intelligence goes!) So something else is going on, and I found it unfair that no one who wrote about the Sudoku "debacle" ever asked what it might be.

My guess is that it's the original XP culture. These guys practice a let-it-all-hang-out style in which they highlight their mistakes and affect being stupider than they really are. Kent Beck affects this "I'm an idiot" style in the original TDD book. I say "affect" because they're not idiots, and I find the tone annoying. But I can see why they do it. It's an educational tactic to say "see, I make dumb mistakes too". They advocate a way of making software that embraces dumb mistakes as part of the process and encourages people to get over the fear of looking like an idiot. Underlying that is a psychological view of software development that can be traced back to Weinberg's "egoless programming".

I may be way off base because I haven't read the posts. I tried once and quickly lost interest. But I do think I recognize the culture.

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

#40
post #33

Earlier quoted context omitted.

"Old-fashioned engineering vs. TDD" is misleading. The difference is that Norvig knew in advance how to solve the problem - constraint propagation - while Jeffries presumably did not. Suppose Norvig had used TDD while writing his solver. He would have used constraint propagation and come up with a good solution that way too. Similarly, any other technique would have yielded just as poor a result for Jeffries. Knowing…

TDD seems to encourage you to dive straight into implementation. For certain problems - e.g. a Sudoku solver - it's much more effective to think through the entire algorithm before starting to write code, and I think that the above debacle supports this argument. You don't exactly need to know any formal theory of constraint propagation to solve this, after all - I wrote a Sudoku solver many years ago based on the al…

I was actually thinking the opposite thing: that TDD gives you another excuse to model your problem instead of moving towards solving it; it's an analysis paralysis trap.

I also think, however fair you want to be to TDD methodology, that it's hard to get around the fact that Norvig didn't do intensive formal testing on his solution. Jeffries presumably applies TDD to lots of problem domains where solutions are obvious ("what's the cleanest way to wire this form to this database table"). TDD has to do more than "not prevent you from discovering solutions"; it also has to demonstrate value.

Post reply on HN