Test, transform, refactor
-
Upload
marcello-duarte -
Category
Technology
-
view
3.013 -
download
1
description
Transcript of Test, transform, refactor
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