Saturday, 6 April 2013

Behaviour Driven Development/Design

In my recent post about Trisha's design talk ( I decided one of my goals was to sit down and properly learn what Behaviour Driven Development/Design was all about. Here are my thoughts...

Googling the subject immediately turns up the definitive article on the subject by Dan North: If you haven't read it yet, I highly recommend it as it is succinct and very easy to follow.

The basic idea of BDD is to align your code more to actual discrete pieces of business requirements (behaviour). This means that when you do TDD, your test must target missing behaviour in your system. Furthermore the tests, along with your classes and methods, should clearly describe their intent.

I've alway been a firm believer in writing "Plain English" code. With code completion in all modern IDEs, there is no excuse for obscuring your code with acronyms or unhelpful names. Making code read like normal sentences enables better communication between everyone.

I really like the tenents of BDD as it ideally keeps code cleaner. If you are having to use a really long sentence to explain what your code is doing, that is usually a warning sign to stop and think! However I am not enamoured with the idea of completely basing your development around BDD (using a tool like JBehave for instance). It seems a bit too prescriptive, although I admit I have not tried it in anger.

Overall, this has inspired me to think long and hard about my development process. Now really want to drill down and makes sure I am getting all the basics right!

No comments:

Post a Comment