5. Test-Driven Development
Overview
Analyse Problem
Test List
Guiding Test
Red
Declare & Name
Arrange-Act-Assert
Satisfy compiler
Green
Implement solution
Fake it
Start over
Refactor
Remove Fake
Remove Code Smell
(No new functionality)
Note new test cases
13. Pair Programming
● Driver: types at the computer
● Navigator
– Looks for:
● Tactical defects: Syntax errors, Typos, Calling the wrong
method
● Strategic defects in the driver's work
– Driver's implementation or design fails to accomplish its goal
– Strategic, long-range thinker of the pair
● Effective Pair: Constantly discusses alternative
approaches and solutions to the problem
● Dysfunctional Pair: Quiet navigator
14. Kata: „Binary Chop“
Write a binary chop method that takes an integer search target and a sorted array of
integers. It should return the integer index of the target in the array, or -1 if the target
is not in the array. The signature will logically be:
chop(int, array_of_int) -> int
You can assume that the array has less than 100,000 elements. For the purposes of
this Kata, time and memory performance are not issues (assuming the chop
terminates before you get bored and kill it, and that you have enough RAM to run it).
15. Randori
● 10 min introduction
● 10 min discussion
● 40 min working on the problem
– 1 driver, 1 navigator
– Every 5 min
● driver → audience
● navigator → driver
● audience (1 person) → navigator
● 5 min break
● 40 min working on the problem
– Like before
● 15 min retrospective
16. Randori in Pairs
● Coding
– Split into pairs
– Work on the Kata for 45 minutes
– 5 minutes debriefing
● 5 minutes break
● Coding
– Split into pairs
– Work on the Kata for 45 minutes
– 5 minutes debriefing
● 10 minutes retrospective
18. Retrospective
● Are you happy with the design of the code you ended up
with? Should you have refactored it more often?
● What are the best aspects of the design of the code
we've ended up with?
● Did we learn anything new?
● Did anything unexpected happen?
● What do we still need to practice more?
● What should we do differently in the next dojo?
● What will you do differently tomorrow in your production
code?