Geeks With Blogs
Lee Brandt's Blog You're only as smart as your last line of code

For some reason, I've been obsessed with Behavio(u)r Driven Development for the last few months. I've only been doing TDD for a little over a year, and I am totally loving what it's done for my design, so why would I look for something else? It's NOT something else. Dave Astels says, "Behavior Driven Development is what you are doing already if you are doing Test Driven Development very well." BDD is how we're supposed to be doing Test Driven Development.skull_brain_xray

The problems that people end up having with TDD stem from the origins of TDD. People (testers mostly) used to write tests to test units of code that the programmers had written to ensure that the code worked. When people started talking about Test DRIVEN development, most people cheerfully thought, "Oh, I just need to write my unit tests BEFORE I write my code." That's NOT TDD. At least it's not the essence of TDD. Just writing unit tests first doesn't get you the full benefit of using those tests to drive your design. It's not that TDD can't give you that benefit. It's just that since TDD comes from a birthplace of testing and a language centered around testing, that developers using tests to drive their development think about testing. They think in the terms they are using. They think in terms on Tests and Fixtures and Assertions, and they lose site of driving the design with the tests.

Somewhere in TDD-land in 2006, Dan North wrote an article about his frustrations with coaching programmers in TDD. He noted that developers seemed confused about using tests to drive their design. He started the BDD "movement" out of that frustration. He wanted to help programmers understand how TDD works and he knew that the language of testing was the largest barrier. The language of "tests" and "assertions" was distracting developers from the main benefit of TDD, which is to drive you design and observing behaviors within their system.

I, too, was frustrated with my inability to grok TDD and to understand when I was testing too much or too little or when I was testing the wrong thing or if I was really testing what I thought I was testing. All my pain came from testing "units". What's a unit? A class? A method? An assembly? We took that language of testers and shoe-horned it into our development methodology. The thing is, TDD is NOT ABOUT TESTING. Guffaw, you say? Why do they call it TEST Driven Development then? Because the pioneers of TDD used testing tools to set up observable specifications, that would help them understand what their system should do from a business standpoint.

Over the coming weeks and months, I'll be chronicling my submersion into BDD. I've been reading white papers, trying different tactics/languages, watching videos and reading lots of BDD framework code. I've had some significant "A-HAs" with respect to BDD and I want to chare them on my blog for three main reasons: One, I want people who are the masters of BDD to tell me when I'm on the right track, off the reservation and when I'm full of it. Two, I want others to learn from me and teach me too. I am hoping to get a small project started and get it out on Google-Code and let people get involved and DO some BDD. Finally, because I am absolutely obsessed with it. I have no idea why I am drawn to it, but I absolutely can't get enough.

Look for the first part of this series very shortly (like this weekend), and PLEASE comment on what I am doing. It is sometimes very hard to recover from going too far in the wrong direction when you are learning something new. So if you're a BDD newbie, tune in and get involved and if you're an old hat, help a brother out.


UPDATE: Check out Part 1

Posted on Friday, November 21, 2008 12:24 AM BDD | Back to top

Comments on this post: Behavior Driven Development Part 0 of n

# re: Behavior Driven Development Part 0 of n
Requesting Gravatar...
This sounds great, I'm looking forward to reading your series. I swallowed the TDD concepts, but was unable to really start writing tests at work. Primarily because of the constant nagging question: "Is this test worth writing?" I'm hoping your investigation of BDD will shed some light on that.
Left by Kevin Berridge on Nov 21, 2008 9:44 AM

Your comment:
 (will show your gravatar)

Copyright © Lee Brandt | Powered by: