From: "David A. Black" Date: 2008-08-16T23:07:21+09:00 Subject: Re: BDD and TDD - What are they for? Hi -- On Sat, 16 Aug 2008, Eleanor McHugh wrote: > On 16 Aug 2008, at 12:51, David A. Black wrote: >> On Sat, 16 Aug 2008, Phlip wrote: >>> Clinton D. Judy wrote: >>> >>>> BDD looks like a way to make it easy for non-programmers to do >>>> programming, but not having people keep several functions in mind at any >>>> one time. And it also does TDD? Am I close? >>> >>> Yes - BDD is TDD with an added layer: A "literate programming" framework >>> that forces you to think in clear English* statements that your client >>> could understand. >> >> I wouldn't call it literate programming in the Knuthian sense, though. >> Knuth says: "The practitioner of literate programming can be regarded >> as an essayist, whose main concern is with exposition and excellence >> of style."[1] It's a different undertaking from writing BDD >> specifications (even though of course it's nice if BDD specifications >> are reasonably well-written). > > Many programmers believe they're bad at writing essays, and rather seeing an > opportunity to improve their skills they would rather write tests. But tests > are only as good as the analysis which goes into them and can very quickly > become redundant when working on greenfield projects with very loose > requirements. They're also as prone to error as any other code so beyond a > certain level of complexity it's not entirely obvious that they improve code > quality rather than hindering it. The essay-writing point, though, isn't at odds with writing tests; it's more about documentation. I agree entirely with your point about complexity -- and also simplicity, as a test like this: assert_equal(my_method(x), 10) can pass based on: def my_method(x) 10 end even if my_method is really supposed to be doing calculations. It's not hard not to do that kind of cheat, of course, but it's a good reminder that there's nothing magical about tests. David -- Rails training from David A. Black and Ruby Power and Light: * Advancing With Rails August 18-21 Edison, NJ * Co-taught by D.A. Black and Erik Kastner See http://www.rubypal.com for details and updates!