Specification by Example

1,500 views
1,251 views

Published on

These are the slides for my Specification by example presentation. This particular version was given as part of my "I'm telling you for the last time"-series (see http://www.marcusoft.net/2013/11/ImTellingYou.html).

Published in: Technology, Business

Specification by Example

  1. 1. Specification by example What? How? When? Marcus Hammarberg
  2. 2. http://www.youtube.com/aptitudsthlm
  3. 3. Bandung
  4. 4. Theory of Constraints
  5. 5. Where is our bottleneck?
  6. 6. http://images.nationalgeographic.com/wpf/media-live/photos/000/212/cache/sinkholes-holes-ground-2007-guatemala-sinkhole_21282_600x450.jpg
  7. 7. Deliberate Discovery
  8. 8. Gojko Adzic
  9. 9. ... it’s no silver bullet, but it seems like a good start Dan North
  10. 10. http://manning.com/adzic/ From Specification by Example Used with permission
  11. 11. http://www.wallpaperpimper.com/wallpaper/Military/F_16_Fighting_Falcon/F-16-Fighting-Falcon-20-9XTZMAN20G-1280x1024.jpg
  12. 12. http://www.wallpaperpimper.com/wallpaper/Military/F_16_Fighting_Falcon/F-16-Fighting-Falcon-20-9XTZMAN20G-1280x1024.jpg
  13. 13. Who sets scope? http://2.bp.blogspot.com/-mJ8gPBlBRjY/TcYv9xOuWlI/AAAAAAAAKvY/0JniIDxlBjY/s1600/how-to-get-your-boss-off-your-back.jpg
  14. 14. How do they know what they want?
  15. 15. How do they know what they want?
  16. 16. Don’t let the customer limit themselves http://www.realestateradiousa.com/blog/wp-content/uploads/2008/09/straitjacket.jpg
  17. 17. Derive scope from business goals http://cojent7.files.wordpress.com/2010/04/business-goals1.jpg
  18. 18. Build the right thing!
  19. 19. §
  20. 20. 1. Start with wide end of it on your right and extending a foot below the narrow end 2. Cross wide end over narrow and turn back underneath 3. Bring up and turn down to loop 4. Pass wide end around frong from left to right 5. Then, up through loop ... 6. And down through knot in front. Tigthen carefully and draw up to collar.
  21. 21. Go concrete with examples http://www.flickr.com/photos/bensutherland/3961418687/
  22. 22. Scenario 1: Account is in credit! Given the account is in credit! And the card is valid! And the dispenser contains cash! When the customer requests €50! Then ! ensure the account is debited €50! And ensure €40 is dispensed! And ensure the card is returned
  23. 23. Key examples
  24. 24. Key examples http://www.bigideastobigresults.com/wp-content/uploads/2009/09/good_enough.jpg
  25. 25. Let’s try that, shall we?
  26. 26. Customers who buys three books gets free shipping
  27. 27. Customers who buys three books gets free shipping Number of books Free shipping?
  28. 28. Customers who buys three books gets free shipping Number of books 1 Free shipping? -
  29. 29. Customers who buys three books gets free shipping Number of books 1 2 Free shipping? -
  30. 30. Customers who buys three books gets free shipping Number of books 1 2 3 Free shipping? X
  31. 31. Customers who buys three books gets free shipping Number of books 1 2 3 4 Free shipping? X X
  32. 32. To get a loan you need to be older than 18
  33. 33. To get a loan you need to be older than 18 Age of applicant Can take loan?
  34. 34. To get a loan you need to be older than 18 Age of applicant 17 Can take loan? -
  35. 35. To get a loan you need to be older than 18 Age of applicant 17 18 Can take loan? X
  36. 36. To get a loan you need to be older than 18 Age of applicant 17 18 19 Can take loan? X X
  37. 37. To get a loan you need to be older than 18 Age of applicant 17 18 19 null? Can take loan? X X eeeeh?
  38. 38. Text http://www.flickr.com/photos/toastytreat/4555895229 Who writes this stuff anyway?
  39. 39. Refactor the specification
  40. 40. Examples should be precise and testable
  41. 41. Examples should be precise and testable Scripts are not specifications
  42. 42. Examples should be precise and testable Scripts are not specifications Specifications should be about business functionality, not software design
  43. 43. Examples should be precise and testable Scripts are not specifications Specifications should be about business functionality, not software design Specifications should be self-explanatory
  44. 44. Examples should be precise and testable Scripts are not specifications Specifications should be about business functionality, not software design Specifications should be in domain language Specifications should be self-explanatory
  45. 45. Shared understanding
  46. 46. Shared understanding Testing
  47. 47. Shared understanding Testing Documentation
  48. 48. Automation http://jbehave.org/reference/stable/images/jbehave-logo.png http://lh6.ggpht.com/_X3kaawac_g4/SuoT1Yd67pI/AAAAAAAAArU/ dhE-WLR0VKE/Unbenannt.png?imgmax=800 http://lh5.ggpht.com/_X3kaawac_g4/S0nxyUKaIYI/AAAAAAAAAu0/ CtKaMavsxoM/cucumber.jpg?imgmax=800
  49. 49. A Cucumber Scenario Scenario 1: Account is in credit! Given the account is in credit! And the card is valid! And the dispenser contains cash! When the customer requests €50! Then ! ensure the account is debited €50! And ensure €50 is dispensed! And ensure the card is returned
  50. 50. http://1.bp.blogspot.com/-3yjyeeTpRFI/Tea15VHttaI/AAAAAAAAC3w/YXoTDAv9tx8/s1600/hard_work.png
  51. 51. One document to rule them all ...
  52. 52. http://www.questpartnership.co.uk/blog/uploaded_images/restructuring-775119.jpg
  53. 53. “... features are an executable map of the current functionality of the system.” Andrew Premdas (BDD Google Group)
  54. 54. ToC and Specification by example
  55. 55. ToC and Specification by example • Better communication
  56. 56. ToC and Specification by example • Better communication • Concrete examples
  57. 57. ToC and Specification by example • Better communication • Concrete examples • Frequent validation
  58. 58. ToC and Specification by example • Better communication • Concrete examples • Frequent validation • Living documentation
  59. 59. Learn more
  60. 60. Learn more
  61. 61. Learn more
  62. 62. Learn more
  63. 63. Learn more
  64. 64. Learn more
  65. 65. www.marcusoft.net @marcusoftnet marcus.hammarberg@aptitud.se
  66. 66. www.marcusoft.net @marcusoftnet marcus.hammarberg@aptitud.se
  67. 67. Recording of this talk http://www.youtube.com/ aptitudsthlm

×