Add TDD to your Toolbox: an introduction to TDD
-
Upload
atroutt -
Category
Technology
-
view
215 -
download
0
description
Transcript of Add TDD to your Toolbox: an introduction to TDD
Add TDD to your toolboxan introduction for beginners
Audrey Troutt @auditty
Audrey Troutt @auditty
What is TDD? Test-Driven Development
Audrey Troutt @auditty
Three conditions to achieve a flow state:
1. clear set of goals and progress
2. clear and immediate feedback
3. confidence in one's ability
Csikszentmihalyi, M.; Abuhamdeh, S. & Nakamura, J. (2005), "Flow", in Elliot, A., Handbook of Competence and Motivation
“TDD is dead. Long live testing.” -David Heinemeier Hansson
Read more: http://bit.ly/1foLebI
Audrey Troutt @auditty
Materials needed:Source code
Unit testing frameworkUnderstanding of requirements
Audrey Troutt @auditty
Simple Case: There’s a bug
Audrey Troutt @auditty
Use Case: From the Ground Up
Audrey Troutt @auditty
“As the tests get more specific, the code gets more generic.”
-Uncle Bob Martin
Audrey Troutt @auditty
Read more: http://bit.ly/1Bs2h70
● ({}–>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)
● … and so on
Audrey Troutt @auditty
Read more: http://bit.ly/1Bs2h70
Pros:● More tests● More testable code● Discover missing
requirements sooner● Uncover novel designs● Increased quality● Refactor/add on with
confidence● Doesn’t generally take
more time● May start conversations
Cons:● First time setup of test
framework takes extra time
● Not always practical (if requirements are not well defined)
● Makes changing object model harder
● May start conversations
Audrey Troutt @auditty
“I credit TDD for teaching me how to test, and I still get huge benefits when I TDD. It’s not perfect, but no one technique is the key to magically producing better code.”
-Justin Weiss
Audrey Troutt @auditty
Read more: http://bit.ly/1BVRR1y
Practice http://codekata.com/
Learn from others http://katas.softwarecraftsmanship.org/
Audrey Troutt @auditty