Today I stumbled across Behavior-Driven Development-BDD for the first time. It’s an evolution of the thinking behind Test-Driven Development-TDD. The theory is intriguing. I like the focus on behaviors rather than tests. It appears to be more user experience and results oriented.
At its core are three principles which really ring true with me:
- Business and Technology should refer to the same system in the same way
- Any system should have an identified, verifiable value to the business
- Up-front analysis, design and planning all have a diminishing return
But the reason I bring this up is because of the “story” model they present for stating requirements:
As a Role
I want Feature
So that Benefit
As a savings account holder
I want to transfer money from my savings account to my checking account
So that I can get cash easily from an ATM
Most requirements or feature requests only have the “what” portion of that statement. How cool would it be to keep the “who” and the “why” right next to the “what” of each requirement?
I don’t know if the cost/benefit is there for this approach. Again, I just read some articles today. It could take a lot of time to gather all of a project’s requirements this way. But there would definitely be some value. Think of the inevitable prioritization discussions. Which feature is most important? I’m certain that keeping the who and why as a part of those discussions would lead to better decisions.
They expand on the “story” model adding scenarios.
Story: transfer from savings to checking account As a savings account holder I want to transfer money from my savings account to my checking account So that I can get cash easily from an ATM Scenario: savings account has sufficient funds Given my savings account balance is $100 And my checking account balance is $10 When I transfer $20 from savings to checking Then my savings account balance should be $80 And my checking account balance should be $30 Scenario: savings account has insufficient funds Given my savings account balance is $50 And my checking account balance is $10 When I transfer $60 from savings to checking Then my savings account balance should be $50 And my checking account balance should be $10
RSpec then allows you to build this story and scenarios right into the actual code. The RSpec site has more on that.
Again, would it be valuable and useful to gather requirements like this prior to coding? We have to get at least some of this information before we can complete this feature. This just seems like an interesting way to document that information. For what its worth, it’s got me thinking new thoughts.