This document discusses strategies for moving away from legacy code using behavior-driven development (BDD). It summarizes three popular options: 1) Rewriting the entire application from scratch using best practices, 2) Doing technical refactoring of the code, and 3) Taking a business-focused approach using the "BDD pipeline" which involves impact mapping, prioritizing features, example workshops, and BDD layers to support planned changes. The presenter argues that the third option of a BDD pipeline is preferable to a full rewrite or only technical refactoring as it focuses on delivering business value over time rather than rewriting the code.
2. BDD Evangelist
BDD Practice Manager @Inviqa
Creator of Behat, Mink, PhpSpec2,
Prophecy
Contributor to Symfony2, Composer
@everzet
3. This talk is about
• Solving purely technical “TCIAM” problem using
behavioural business analysis and discovery process
• Building a delivery strategy on the idea of the
change appreciation
• Real-life experience
4. This talk is not about
• Greenfield projects
• Maintenance-mode projects
• Solutions for everyone
• How to write code
11. If the project can afford at least one full-time
specialist on a payroll that whines how horrible
this project is, then surely it did something right.
15. This world is full of brilliant projects that nobody
wants to whine about. Sadly, it’s often simply
because there’s no one left to pay for that.
16. The truth is:
You deliver value!
Just not as effectively as you could
17. • Great value + Awful code = Great product today
• Great value + Great code = Great product tomorrow
• No value + Any kind of code= Awful product anytime
18. • Great value + Awful code = Great product today
• Great value + Great code = Great product tomorrow
• No value + Any kind of code= Awful product anytime
21. Three popular options
1. Rewrite an entire application using “the right way”
2. Do technical refactoring
3. Do business-oriented rewrite using “BDD pipeline”
29. #2: Technical Refactoring
• Blackbox testing
• New routing
• New templating system
• Migration of model layer (MySQL -> Mongo)
• Whatever else that is easy to replace
40. Questionnaire
1. Where is this project going?
2. Which features are going to change?
3. How are they going to change?
4. How to support that change?
41. “BDD Pipeline”
1. Where is this project going?
2. Which features are going to change?
3. How are they going to change?
4. How to support that change?
• Impact Mapping
• Business Prioritisation
• Example (3 Amigos) Workshop
• BDD layers
42. 1. Where is this
project going?
Impact Mapping
43. – Gojko Adzic
“Impact mapping is a strategic planning technique
that prevents organisations from getting lost
while building products and delivering projects,
by clearly communicating assumptions, helping
teams align their activities with overall business
objectives and make better roadmap decisions.”
44. Four levels of Impact Map
1. Why? are we doing all this (rewrite)? What is the
goal we’re trying to achieve?
2. Who? will be impacted by it?
3. How? can they help us to achieve the goal?
4. What? can we do to support them?
54. 3. How are these features
going to change?
Example (3 Amigos) workshops
55. Three layers of a User-Story
• Business rule(s)
• Communication
• Acceptance criteria
56. Three layers of a User-Story
• Business rule(s) == Acceptance criteria
• Communication
57. Three layers of a User-Story
• Business rule(s) == Acceptance criteria
• Communication == Examples
58. Three layers of a User-Story
• Business rule(s)
• Communication == Examples == Acceptance criteria
59. In order to keep track of stock
As a store owner
I want to add items back to stock when they are returned
Feature: Returned items go back to stock
60. Scenario: Refunded items should be returned to stock
In order to keep track of stock
As a store owner
I want to add items back to stock when they are returned
Feature: Returned items go back to stock
61. Scenario: Replaced items should be returned to stock
Scenario: Refunded items should be returned to stock
In order to keep track of stock
As a store owner
I want to add items back to stock when they are returned
Feature: Returned items go back to stock
62. Scenario: ...
Scenario: Replaced items should be returned to stock
Scenario: Refunded items should be returned to stock
In order to keep track of stock
As a store owner
I want to add items back to stock when they are returned
Feature: Returned items go back to stock
63. Scenario: ...
Scenario: ...
Scenario: ...
Scenario: ...
Scenario: ...
Scenario: Replaced items should be returned to stock
Scenario: Refunded items should be returned to stock
In order to keep track of stock
As a store owner
I want to add items back to stock when they are returned
Feature: Returned items go back to stock
64. Given a customer previously bought a black sweater from me
And I currently have three black sweaters left in stock
When he returns the sweater for a refund
Then I should have four black sweaters in stock
Scenario: Refunded items should be returned to stock
In order to keep track of stock
As a store owner
I want to add items back to stock when they are returned
Feature: Returned items go back to stock
66. Given a customer previously bought a black sweater from me
And I currently have three black sweaters left in stock
When he returns the sweater for a refund
Then I should have four black sweaters in stock
Scenario: Refunded items should be returned to stock
In order to keep track of stock
As a store owner
I want to add items back to stock when they are returned
Feature: Returned items go back to stock
71. Step#2: Discuss old logic
1. What should this thing do
2. What if it suddenly stops doing it?
3. How would you know if it doesn't work?
4. How would you know if it does?
72. Step#3: Prepare for A change
1. Cover old behaviour in an end-to-end fashion
2. Make sure that scenarios/tests are green
3. Refactor code to make the upcoming change easier
4. Make scenarios/tests green
73.
74. Step#4: Make a change
1. Automate new scenarios
2. Make scenarios green by applying BDD loops
81. Step#0: Prepare for any change
1. Prepare the application infrastructure for bridging
a. Share sessions
b. Share data
2. Prepare the server infrastructure for bridging
82. Step#1: Make a change
1. Automate new scenarios
2. Make scenarios green by applying BDD loops