aspose file tools*
The moose likes Design and the fly likes How can BDD be used to model the Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Design
Bookmark "How can BDD be used to model the "intention" of the user?" Watch "How can BDD be used to model the "intention" of the user?" New topic
Author

How can BDD be used to model the "intention" of the user?

Ashish Dutt
Ranch Hand

Joined: Apr 12, 2013
Posts: 172

Test Driven Development (TDD) we write a test case first, application code afterwards and then we test the application code based on the test cases written earlier.
Any novice programmer can be confounded by this paradigm that TDD offers wondering how do you write a test case for an entity that does not exist. So Dan North came up with a solution suggesting that instead of writing test one should think of specifying behaviour. So that gave birth to Behaviour Driven Development.
Now BDD is make more sense to a novice programmer like me than TDD. Therefore in the light of this i want to know Marco is, that how can i use BDD to specify the so called "behaviour" when the OOP principles are already there. OOP model says that "function or method" is a behaviour which makes sense. So it follows logically that behaviour is an action, that again makes sesnse to me.
This is what i would like to know, how can BDD help me to model the intention of the user?
Being a student of natural language processing and data mining i can see the worth of BDD and its exponential growth in future too but i must connect the dots together. I believe behaviour and intention are different, from the perspective of a user.
But what confounds me now is, how will i model and test the "intention" of the user in the light of BDD approach with Javascript?


Still a beginner at crafting quality coding but have the zeal to learn more. Your help would be appreciated.
My Blog on Learning Analytics
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Ashish Dutt wrote:This is what i would like to know, how can BDD help me to model the intention of the user?

Ashish,
Unit tests (for TDD) and specifications (for BDD) are different in that specifications are at a higher level of abstraction.

For example, a user's intent is to withdraw money from their bank account, so the spec says, "As an account holder I want to withdraw cash from my account so I can buy something." While you could write a single method that does everything necessary to validate the user's credentials, retrieve their account balance, issue commands to the ATM to extrude (can't think of a better term for it) the cash, then reduce the account balance by the amount requested - whew! - it's more likely you'll create several classes with reasonable methods to handle the different responsibilities depicted in my description.

The BDD spec doesn't know or care about all the details, and neither does the user, their intent is to withdraw some cash so they can buy something - all the rest isn't important to them, though it would be to the bank.

Does that help?

Burk


SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
Marco Emrich
Author
Greenhorn

Joined: Aug 14, 2013
Posts: 20
    
    5
Ashish Dutt wrote:This is what i would like to know, how can BDD help me to model the intention of the user?
But what confounds me now is, how will i model and test the "intention" of the user in the light of BDD approach with Javascript?


Hi Ashish,

I'm not sure to understand your question right. How do you define "intention of the user"? For me, "Intention" means "what does the user really want to do". This could be something completely different from the actual behaviour of an application. Hopefully there is a large match. Honestly, I think BDD won't help you here. It's the responsibility of a product owner to gather and define the correct requirements (matching user intention). BDD helps you with the next step: Writing down the requirements as specs in an unambiguous and executable form.

Marco Emrich
Author
Greenhorn

Joined: Aug 14, 2013
Posts: 20
    
    5
Burk Hufnagel wrote:
Unit tests (for TDD) and specifications (for BDD) are different in that specifications are at a higher level of abstraction.


Hi Burk,

you can define this for yourself if you want. Everyone, has his/her own definition of BDD these days It is, however, not the way Kent Beck, Dan North, and so on see BDD. You can easily have High-Level Tests in TDD - called acceptance or customer tests there. There is even the ATDD methodology working on that. On the other hand, you can use BDD on unit test level quite easily too, specifying fine grained specs. I do this a lot in my book. BDD usually starts at the outside, doing outside-in development - but this is no absolute "must have" and is also done within the "London School of TDD" (see the Book from Nat Pryce).

The differences between BDD & TDD is a heated discussion. Therefore I spent a complete chapter on my book about this topic ("What is BDD?")
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can BDD be used to model the "intention" of the user?