test, transform, refactor
DESCRIPTION
Let's have a close look into the Red-Green-Refactor cycle and understand the subtleties of each step. When we go down the rabbit hole of Test Driven Design we sometimes take too big steps leading us to many failed tests we just can bring back to green without writing a lot of code. We need to take a step back and take the shrinking potion of baby steps again. This very illustrative talk, full of test and code examples, will dig into each of the steps of TDD to help you understand how to keep a sustainable pace that will lead you in the right track.TRANSCRIPT
by @_mdPHPUK 2014
Test, Transform,
Refactor
TEST,
REFACTOR
Test, Transform,
Refactor
Test, Transform,
Refactor
Test, Transform,Refactor
TRANSFORM,
@_md Marcello Duarte
Lead developer
Head of Training Kata sensei
Learning
@_md Marcello Duarte
Lead developer
Head of Training
Kata
formmovementpracticedeliberate
Kata
20 minutesthrow away
TDDrefactor
Test
CodeRefactor
3Rules
no code without test
enough to go red
enough to go greenTDD
no code without test
enough to go red
enough to go green
Test
Code
4Rules
tests run and passdryremove opacitySimple Design
simplify
Refactor
The Roman Numerals Kata
Converting arabic numbers into their roman equivalent
!
e.g. 2149 => MMCXLIX
Test
Code
Refactor
Make it red
Make it green
Make it right
The Roman Numerals Kata gone wrong demo
Introducing TPP
Test
Transform
Refactor
Make it more specific
Make it more generic
Put on the design hat
Transformations (just the most basic ones)
null to constantconstant to constant+constant to scalarstatement to statementsunconditional to ifif to while
Jim Weirich’s Roman Numeral Kata*
http://www.flickr.com/photos/jorendegroof/4471189540/
* in PHP
Walking skeleton
[Cockburn 94]
Transformation null -> constant
Transformation null -> constant
Transformation unconditional -> if
Transformation unconditional -> if
Transformation statement -> statements
Transformation statement -> statements
Transformation unconditional -> if
Transformation unconditional -> if
Refactor time?
Transformation if -> while
Transformation if -> while
Condition to loop transformation !
is a great indicator you are in the right track of solving the algorithm
[Martin 13]
Katas and Learning
Kata Deliberate Practice
Koan Deliberate Learning
• Optimising for performance • Minimising variance
• Optimising for discovery • Maximising variance
[North 12]
Learning TDD is learning all that TDD does for you
“The beauty of a move lies not in its' appearance but in the thought behind it.”
My Systemelements of chess
positional play
illustrative games
First learn the elements of design Then learn how to drive it with test
we are hiring try phpspec!
follow @_md
Marcello Duarte
inviqa.com/tdd-immersion-day/
Thank you !
Questions or Comments?
want to learn more? inviqa.com/tdd-immersion-day/
@_mdjoind.in/10711