Slide of the T.D.D. Coding Dojo (programming language neutral version)
T.D.D. Dojo Agenda (3 hours):
05' Welcome and Dojo rules.
15' T.D.D. in a very small nutshell (slides)
05' Q&A
20' TDD Sempai demo (I will show how to use TDD to solve a simple kata)
10' Choose the kata
25' Kata first round
05' break
25' Kata second round
05' break
25' Kata third round
05' break
30' Lesson learned: code sharing
Architecture decision records - How not to get lost in the past
TDD Dojo - Test Driven Development Coding Dojo
1. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Driven Development Dojo
A safe way to be introduced to a powerful way of programming
!
!
Roberto Bettazzoni
2. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
About me
Agile Coach
eXtreme Programming Trainer
!
>30 years of coding (and still proudly counting)
!
roberto.bettazzoni@agile42.com
linkedin.com/in/robertobettazzoni
@bettazzoni
Roberto Bettazzoni
3. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
T.D.D. Coder Dojo Agenda
• TDD in a very small nutshell
• TDD Sempai demo
• For each Kata (35 min.)
‣ Choose the Kata
‣ execute
‣ break (5 min.)
‣ StandUp
道場
型
5. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test-Driven Development as Formula
TDD = ( Test First
+ Unit Testing
+ Refactoring )
* Baby Steps
9. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test
Method to verify isolated units of code
10. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test
user
code
Acceptance Criteria test
Functional test
Unit test
11. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test
Method to verify isolated units of code
12. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test
Method to verify isolated units of code
13. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test
assert condition
14. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test
Method to verify isolated units of code
15. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation
B
D
C
A
16. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation
Run 4 tests: A, B, C, D
B
D
C
A
17. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation
B
D
C
A
18. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation
Run 3 tests: A, B, D
B
D
A
19. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Test Isolation
Run 3 tests: D, A, B
B
D
A
20. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test library
test()
21. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test library
setUp() - test() - tearDown()
22. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test
Method to verify isolated units of code
23. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
unit test - What is a unit of code?
Classes
Methods
Functions
Blocks of code
24. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Code Isolation (or Unit Isolation)
B
D
C
A
25. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Code Isolation (or Unit Isolation)
B
D
C
A
27. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Refactoring
Changing existing code
without changing its external behavior
28. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Refactoring
Make your code better
without changing its external behavior
29. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Three Principles to Write Good Code
1. Find good names
2. Remove duplications
3. There is no third principle
30. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Refactoring. The Sensei Words
Any fool can write code that a
computer can understand.
Good programmers write code that
humans can understand
Martin Fowler, Refactoring: Improving the Design of Existing Code, 1999 pag. 15
32. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Baby steps.
… proceed iteratively in baby steps —
the shortest step that can be
appreciated in the right direction
Kent Beck, Extreme Programming Explained 2nd Ed. 2004
36. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
dojo
道場(place of the way)
37. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
kata
型(form)
38. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Dojo Kun (the dojo rules)
At the Dojo one can’t discuss a form without code, and
one can’t show code without tests. It is a design training
place, where it is acknowledged that “the code is the
design” and that code without tests simply doesn’t exist.
Emily Bache, The Coding Dojo Handbook, 2012
(translated from Christophe Thibaut, Laurent Bossavit’s blog, 2005)
You are here to practice, not to build something
No output is required, neither logging or tracing activities
Every aspect of the kata (design, UI …) is in your hands
39. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Sempai Demo
Let’s start
the Sempai TDD Demo
41. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
TDD
ALL CODE IS GUILTY
UNTIL PROVEN INNOCENT
42. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Food for thoughts