Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm doing a presentation this week for Uni on the application of TDD and BDD. I'm trying to focus on types of code (such as algorithms, business logic or crud) and which methodology (if at any at all) would be most suited to testing that kind of code?

Any opinions or references / links would be most appreciated.

share|improve this question
Can you be more specific in your question? We don't really like doing people's homework for them. –  blueberryfields Feb 13 '12 at 17:29
I'm really not trying to get you to do my homework for me. This is for my part-time masters and I thought some users here would have some insight into the question I'm trying to explore and wouldn't mind me asking for their opinion. I'm trying to explore the notion that certain testing / development styles might be suited to different types of code. Does it make sense to develop CRUD screens without TDD/BDD but simply create integration tests afterwards? Would business logic code really suit being developed using a TDD style? –  Max Feb 13 '12 at 23:08
It may be that common consensus is that this a silly proposition and is it best practice to pick one development style and aim for 100% test coverage. I just wanted to gauge opinion and feedback. –  Max Feb 13 '12 at 23:13
add comment

1 Answer

up vote 2 down vote accepted

I can certainly link you to a list of good BDD resources which I made.

BDD these days is mostly used at an application level, rather than for units of code, but it did start out that way and many people who use it for unit-level testing describe it as "TDD done well". To get a good idea of how to use it this way, I recommend Dan North's "Introducing BDD".

You could also look at Kent Beck's "TDD by Example" and Martin Fowler's "Refactoring" for a good understanding of TDD.

Really, though, neither of them are about testing. TDD and BDD are both about exploring, questioning and discovering things about code. They're really focused on learning, rather than testing. You do happen to get tests and living documentation as a side-effect, and that's very useful, but if you think of it as a test it might be tricky - as Dan's article will show.

As a side-effect, TDD / BDD is pretty good for testing algorithms and business logic. You'd probably want more of an integration test for CRUD, but you can use all the same tools.

share|improve this answer
Thank you for taking the time to write such a detailed answer. I will definitely look into these resources. Even though TDD and BDD are much more than simply ways of testing code, perhaps I can still answer a similar question in my presentation such as which types of code would really benefit from exploration, questioning and discovery in a TDD or BDD style. Is there any merit in exploring this as a question? It's not too late to change my presentation topic! –  Max Feb 13 '12 at 23:00
It's an excellent question! May I point you to another blog post that will also help? - dannorth.net/2010/08/30/introducing-deliberate-discovery - and my quick answer: anything you've never done before. –  Lunivore Feb 14 '12 at 9:37
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.