I have done a lot of BDD reading since the beginning of the weekend. At the moment I am reading about the imperative style v the declarative style. The imperative style is often described as an anti pattern like here: http://fasteragile.com/blog/2015/01/19/declarative-user-stories-translate-to-good-cucumber-features/, which says: "Perhaps the easiest way to show a good user story style is by first showing an antipattern. Here is a user story written in an imperative style.". Please consider these scenarios, which are an imperative style:
Given a Person with a gender of male, an age over 18 and age under 21
When I calculate eligibility for loan
Then eligible for x
Given a
Person with a gender of male and an age over 21 When I calculate
eligibility for insurance Then eligible for y
Female scenarios go here.
Here is a declarative style:
Given a Person
When I calculate eligibility for insurance
Then the result should be insurance that the person is eligible for
In all the examples I see that recommend the declarative style; it does not seem to matter what the parameters are. However, in my case above the parameters drive the outcome e.g. a person is eligible for y if they are male and over 21. I guess this is similar to a calculator, which adds numbers.
Therefore I believe the imperative style is more appropriate here. However, I am new to this so wandering what approach is "better" in this specific scenario.