Most Read Latest News Blog Resources
Digg!  Digg
Reddit  Reddit


            iphoneapp GET THE APP!

BDD Coming to a tool near you




July 15, 2008 —  (Page 1 of 3)

Behavior-Driven Development (BDD) sounds like either a modern theory of raising children or yet another way to mess with how programmers write code. It is the latter, but fortunately, unlike other xDD methodologies, it suggests only small changes to the way you currently do things. In its simplest form, BDD specifies the behavior of code and tries to have the code be expressive of that behavior, rather than maintaining a disconnected relationship between specification and implementation.

Let me illustrate. Behaviors are frequently expressed with keywords, such as: given, when, then and should. So, for example: given the 2008 tax tables, when a head of family has taxable income of less than US$12,000, then the tax should be $0. At a lower level that is closer to code: given a new linked list, then the list should be empty. And: given an empty linked list, when we add an item, then the list should not be empty.

At first blush, this might seem like another way of writing an if/then statement, save with a level of verbosity that exceeds COBOL. True, but that misses the point: First, you can define your scenarios, then insert the code into the scenarios that make it happen. Tools, such as easyb (which uses the JVM scripting language Groovy), enable code to be inserted into the scripts resulting in a very readable explanation of what is being done. Here is an example from the easyb site that illustrates the process.

Starting with the requirements articulated with BDD-style language: Given that a user mistypes a ZIP code, and given the ZIP code-validation service is up and running, when validation is performed, then the service should indicate the ZIP code is invalid.

In easyb, the implementation is woven into the constraints, and the result is:

      given "an invalid zip code", {
        invalidzipcode = "221x1"
      }

      and "given the zipcodevalidator is initialized", {
        zipvalidate = new ZipCodeValidator()
      }

Related Search Term(s): Software development

Pages 1 2 3 


Share this link: http://www.sdtimes.com/link/32488
 

Add comment


Name*
Email*  
Country     


  • Comment
  • Preview
Loading



 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 
Download Current Issue
ISSUE 8/1/2010 PDF

Need Back Issues?
DOWNLOAD HERE

Receive the print Edition?


 
blogs tab
Like Ruby n' Rails
Programming languages and Web frameworks go together like peas n carrots. Or Ruby n' Rails.
07/30/2010 04:36 PM EST

Adobe buys a Web-based IDE
Adobe looks to buy a rapid and agile Web development environment.
07/28/2010 03:49 PM EST

OpenStack opens up
OpenStack looks to be an intriguing new idea for running clouds.
07/28/2010 01:56 PM EST

 

Events calendar tab
8/1/2010 to 8/5/2010
Boston
SHARE

8/2/2010 to 8/6/2010
Redmond, Wash.
1105 Media

8/9/2010 to 8/13/2010
Orlando
Agile Alliance

8/23/2010 to 8/26/2010
San Jose
S&S Media

8/30/2010 to 9/2/2010
San Francisco
VMware