SlideShare a Scribd company logo
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
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
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
道場
型
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
Test Driven Development
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
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
Test First
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
Test First Programming
!
“Write a failing automated test before
changing any code.”
!
Kent Beck, Extreme Programming Explained 2nd Ed. 2004
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
Unit Test
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
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
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
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
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
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
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
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
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
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
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
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()
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()
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
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
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
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
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
Code Refactoring
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
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
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
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
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
Baby Steps
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
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
The TDD process
Unit tests suite pass
unit testa unit test
Write a unit test
Write the code
Refactor the code
Refactor the tests
Unit test
pass
Unit test fails
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
The TDD process from the Functional Tests
Add a functional test
Run the test &
check failure
Run all functional
tests see all pass
!
Refactor
the
Design
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
Welcome to the coding dojo
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)
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
kata
型(form)
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
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
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010.
Coding Dojo retrospective
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
agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
Food for thoughts

More Related Content

PDF
Unit test in a nutshell
PDF
Scrum in a nutshell
PDF
Introduction of unit test to management
PDF
Presentation of agile engineering practices
PPTX
Engineering practices within scrum
PDF
Agile engineering practices – a short overview
PPT
Tech talks #1- Unit testing and TDD
PPTX
(Agile) engineering best practices - What every project manager should know
Unit test in a nutshell
Scrum in a nutshell
Introduction of unit test to management
Presentation of agile engineering practices
Engineering practices within scrum
Agile engineering practices – a short overview
Tech talks #1- Unit testing and TDD
(Agile) engineering best practices - What every project manager should know

What's hot (20)

PPTX
Agile Testing by Example
PDF
QA in Agile World
PPTX
Agile testing - Testing From Day 1
PDF
About Agile Testing Alliance (ATA)
PDF
Agile Testing Framework - The Art of Automated Testing
PDF
What is Agile Testing?
PDF
What is Agile Testing?
PDF
Certified Professional Master Agile Testing information and highlights
PPTX
Implementing automation in definition of done is team effort
PDF
What is Agile Testing?
PDF
ATD 2018: Journey Ice-cream cone approach
PPTX
Agile tour ncr test360_degree - agile testing on steroids
PPT
Trends in Agile Testing by Lisa Crispin
PPT
Testing in Agile Projects
PDF
Test Automation Strategies for the Agile World
PPTX
The New Gives and Takes in a testers role
PPTX
Agile test tools
PDF
Selenium Certification
PDF
DevOps or Devops - living in silos or living as a team
PPTX
Selenium certification program
Agile Testing by Example
QA in Agile World
Agile testing - Testing From Day 1
About Agile Testing Alliance (ATA)
Agile Testing Framework - The Art of Automated Testing
What is Agile Testing?
What is Agile Testing?
Certified Professional Master Agile Testing information and highlights
Implementing automation in definition of done is team effort
What is Agile Testing?
ATD 2018: Journey Ice-cream cone approach
Agile tour ncr test360_degree - agile testing on steroids
Trends in Agile Testing by Lisa Crispin
Testing in Agile Projects
Test Automation Strategies for the Agile World
The New Gives and Takes in a testers role
Agile test tools
Selenium Certification
DevOps or Devops - living in silos or living as a team
Selenium certification program
Ad

Similar to TDD Dojo - Test Driven Development Coding Dojo (20)

PDF
Agility meets regulatory compliance
PDF
Useful Lean Tools: Value Stream Mapping and Kanban
PDF
IBM Innovate2014 - Is Agile Compliance an Oxymoron?
PDF
Will Agile work in my embedded development environment?
PDF
Thoughts on Lean Product Development at CAMUG, YYC Nov 2014
PDF
The agile reading glasses: foundation principles and history being agile appr...
PDF
Lean Product Management @ SDEC13, Winnipeg
PDF
Adopting Scrum: an enterprise transformation
PDF
Adopting Scrum: an enterprise transformation (Andrea Tomasini, agile42)
PDF
Agile Testing is nonsense, because Agile is about testing!
PDF
Why practices are not as important as principles?
PDF
From a Product Vision to a running software... and back again, and agile coac...
PDF
A journey to_be_a_software_craftsman
PDF
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
PDF
Where next?
PDF
Why self-organization might not work, and what has that to do with the compan...
PDF
Keynote stop scaling... start growing an agile organization!
PDF
Great Agile Teams @ SDEC13, Winnipeg
PDF
Is your organisation reaping the possible benefits of scaling agile?
PDF
Out of Sight, Out of Mind: Survival tricks and tools for remote developers
Agility meets regulatory compliance
Useful Lean Tools: Value Stream Mapping and Kanban
IBM Innovate2014 - Is Agile Compliance an Oxymoron?
Will Agile work in my embedded development environment?
Thoughts on Lean Product Development at CAMUG, YYC Nov 2014
The agile reading glasses: foundation principles and history being agile appr...
Lean Product Management @ SDEC13, Winnipeg
Adopting Scrum: an enterprise transformation
Adopting Scrum: an enterprise transformation (Andrea Tomasini, agile42)
Agile Testing is nonsense, because Agile is about testing!
Why practices are not as important as principles?
From a Product Vision to a running software... and back again, and agile coac...
A journey to_be_a_software_craftsman
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
Where next?
Why self-organization might not work, and what has that to do with the compan...
Keynote stop scaling... start growing an agile organization!
Great Agile Teams @ SDEC13, Winnipeg
Is your organisation reaping the possible benefits of scaling agile?
Out of Sight, Out of Mind: Survival tricks and tools for remote developers
Ad

More from Roberto Bettazzoni (15)

PDF
Trasformare il debito tecnico in un vantaggio competitivo
PDF
The mythical technical debt. (Brooks, please, forgive me)
PDF
Giornat Mondiale della Retrospettiva 2020 - Riassunto Meetup Remoto
PDF
Complexity indicators: estimation precision and test types
PDF
Why you need to change your way of working
PDF
Presentation TDD in Python
PDF
Cynefin Lego Game Agenda (versione 2.0 in Italiano)
PDF
Pair programming and pair training
PDF
Presentazione eXtreme Programming
PDF
Agile e Open Source
PDF
Esempio di code kata
PDF
Introduzione alle metodologie e pratiche Agili ... ma l'agile c'entra qualcos...
PDF
Una fugace occhiata al Test Driven Development (2006)
PDF
The BDD live show (ITA)
PDF
Programmazione android per esseri umani
Trasformare il debito tecnico in un vantaggio competitivo
The mythical technical debt. (Brooks, please, forgive me)
Giornat Mondiale della Retrospettiva 2020 - Riassunto Meetup Remoto
Complexity indicators: estimation precision and test types
Why you need to change your way of working
Presentation TDD in Python
Cynefin Lego Game Agenda (versione 2.0 in Italiano)
Pair programming and pair training
Presentazione eXtreme Programming
Agile e Open Source
Esempio di code kata
Introduzione alle metodologie e pratiche Agili ... ma l'agile c'entra qualcos...
Una fugace occhiata al Test Driven Development (2006)
The BDD live show (ITA)
Programmazione android per esseri umani

Recently uploaded (20)

PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administration Chapter 2
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Transform Your Business with a Software ERP System
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
history of c programming in notes for students .pptx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Essential Infomation Tech presentation.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
Design an Analysis of Algorithms II-SECS-1021-03
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administration Chapter 2
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Transform Your Business with a Software ERP System
Which alternative to Crystal Reports is best for small or large businesses.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
history of c programming in notes for students .pptx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Essential Infomation Tech presentation.pptx
Upgrade and Innovation Strategies for SAP ERP Customers
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
How Creative Agencies Leverage Project Management Software.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
wealthsignaloriginal-com-DS-text-... (1).pdf
L1 - Introduction to python Backend.pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle

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 道場 型
  • 4. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. Test Driven Development
  • 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
  • 6. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. Test First
  • 7. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. Test First Programming ! “Write a failing automated test before changing any code.” ! Kent Beck, Extreme Programming Explained 2nd Ed. 2004
  • 8. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. Unit Test
  • 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
  • 26. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. Code Refactoring
  • 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
  • 31. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. Baby Steps
  • 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
  • 33. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. The TDD process Unit tests suite pass unit testa unit test Write a unit test Write the code Refactor the code Refactor the tests Unit test pass Unit test fails
  • 34. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. The TDD process from the Functional Tests Add a functional test Run the test & check failure Run all functional tests see all pass ! Refactor the Design
  • 35. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. Welcome to the coding dojo
  • 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
  • 40. agile42 | We advise, train and coach companies building software | www.agile42.com | Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported Licenseagile42 | We advise, train and coach companies building software www.agile42.com | All rights reserved. Copyright © 2007 - 2010. Coding Dojo retrospective
  • 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