Yes, I am a Behaviour Driven Development (BDD) man - and in this post I am limiting my discussion to Behaviour Driven Programming - the reframing of the very badly named Test Driven Development (TDD) practice. If in the future I find a better coding practice, I will switch to it, but at the moment this is the best I've found. I don't necessarily follow the practice to the letter, but I do exude the spirit of BDD.
In case you are unfamiliar with it, BDD (and its predecessor TDD) are all about developers designing their code - code that is simple to use, simple to maintain, squeaky clean, follows best practices (like SOLID development principles), and it just happens to result in the very welcome side-effect of an automated test asset suite. If you don't understand the benefit of automated tests already, then... I am sorry...
For almost two years now, I have been attempting to up-skill and convince various developers and teams and management at work about the benefits of BDD. The slow progress that has been made at work in no way correlates with my efforts - it is quite difficult to change the culture of teams. However, slowly and surely, I am happy to say that progress is being made.
Late last Friday night, I was showing a well-intentioned developer how he could perform behaviour tests on his code. We started by trying to retrofit the tests to his code, but it was quite smelly to say the least. In addition, because of the structure of the code, we were struggling to identify the valuable test cases we would create. In my disbelief, I quickly reached the point where I blurted out something along the lines of "if it were written using BDD/TDD practices in the first place, then we wouldn't be having this trouble" - and it was true.
FLASH! It was one of those defined moments in history. I almost didn't realise what I had said, but then it sank in... and the door reopened to showcase the power of BDD/TDD...
We then scrapped most of the pre-written code, and in a Pair-Programming style I walked the developer through the process of how to write clean code and perform unit testing with the practice of BDD/TDD. The resulting code was clean, intuitive, highly maintainable (as it read like a story), and was easily tested.
We compared the code that he had written with the new code, and there was no contest - the BDD/TDD code was significantly better, and the tests were easy and quick to create.
BDD/TDD is the unavoidable "pit of success" that enables the writing of clean, high quality code with automated test cases.