7. Ciclo
Test en ROJO Test en VERDE Refactor
Baby steps Prohibido pensar Transformations
8. Evolución del código con TDD
• Tests progresan desde una definición genérica hacia la más específica
• Implementación progresa desde específica hacia genérica
9. Refactor
Code refactoring is "a disciplined way to restructure code",[1] undertaken
in order to improve some of the nonfunctional attributes of the software.
By continuously improving the design of code, we make it easier and easier to work with. This
is in sharp contrast to what typically happens: little refactoring and a great deal of attention
paid to expediently adding new features. If you get into the hygienic habit of refactoring
continuously, you'll find that it is easier to extend and maintain code.
—- Joshua Kerievsky, Refactoring to Patterns
10. Transformation
({}–>nil) no code at all->code that employs nil
(nil->constant)
(constant->constant+) a simple constant to a more complex constant
(constant->scalar) replacing a constant with a variable or an argument
(statement->statements) adding more unconditional statements.
(unconditional->if) splitting the execution path
(scalar->array)
(array->container)
(statement->recursion)
(if->while)
(expression->function) replacing an expression with a function or algorithm
(variable->assignment) replacing the value of a variable.
http://cleancoder.posterous.com/the-transformation-priority-premise
11. Waterfall
• Requisitos
• Análisis Cada paso
• Diseño inyecta feedback
• Coding
al anterior
• Testeo
16. TDD BDD
Top-down / Bottom up Estrategias Outside in
Arrange Given ...
Act Forma de una prueba When ...
Assert Then ...
Example driven Fuerza motriz Business value driven
xUnit Standard --
Frameworks
jUnit Concordion, EasyB, JBehave
Java
17. Herramientas
KISS,YAGNI, SOLID, DRY
Bloc de notas, estrategia de testeo
Autotest, TDGotchi, Pulse
Pair programming, ping-pong, peer-review
Esto va de hacer software bien hecho
18. Ejemplo BDD
Describir comportamiento Escribir la definición de un paso Ver cómo falla
Escribir lo mínimo para que pase Ver que pasa Iterar hasta que todo esté verde
Y, finalmente, repetir todo con nuevos comportamientos hasta que se acabe la pasta/alcance/tiempo