SlideShare a Scribd company logo
1 of 44
Download to read offline
Test Driven Development
 and Related Techniques
 For Non-Developers ;-)
        IBM 2012

     Peter Kofler, ‘Code Cop’
         @codecopkofler
       www.code-cop.org
    Copyright Peter Kofler, licensed under CC-BY.
Peter Kofler

•   Ph.D. (Appl. Math.)
•   (Java) Software Developer
•   with IBM since 1 year
•   SDM Costing, IGA, GBS
The opinions expressed here are my
own and do not necessarily represent
 those of current or past employers.
Agenda
1) What does it
  look like?
2) Why is it
  important?
3) What you
  need to do!
4) Summary
1) So what is it all about?



The Prime Factors
  Kata (Demo)
What Exactly Will We Do Now?
●
    write code together
●
    using TDD
●
    see techniques
      and patterns
●
    discuss while
     doing
The Requirements.
• Write a class named “PrimeFactors” that
  has one static method: generate.
  – The generate method takes an integer
    argument and returns a List<Integer>.
  – That list contains the prime factors in
    numerical sequence.



   http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata
First Some Math.
●
 Prime Number: a natural number > 1
that has no divisors other than 1 and itself.
    ●
        e.g. 2, 3, 5, 61, 67, ..., 997, ..., 243112609-1, …
●
 Prime Factors: the prime numbers that
divide an integer exactly without remainder.
    ●
        e.g. 2 = 2,
        4 = 2 * 2,
        24 = 2 * 2 * 2 * 3
        288 = 25 * 32
The Requirements (for Mortals).
• code a file/module/class “PrimeFactors”
• code a function/method/routine
  “generate”
• accept an integer number as parameter
• return the prime factors of that number
Demo
(Code Kata)
Keep the bar green to keep the code clean.
Unit Testing
• test individual units
• isolate each part
• show that the individual parts are correct
• regression testing
• sort of living documentation
• executed within a framework
                       http://en.wikipedia.org/wiki/Unit_testing
Test-Driven Development
• add a test
• run all tests and see if the new one fails
• write some code
• run all tests and see them succeed
• refactor code mercilessly
• „Red Green Refactor“
               http://en.wikipedia.org/wiki/Test_Driven_Development
A minute ago all
their code worked
Refactoring

 Refactoring is a technique
     for restructuring
  an existing body of code,
altering its internal structure
    without changing
    its external behavior.
                          (Martin Fowler)
Refactoring
• small behavior preserving transformations
• sequence of transformations produce a
  significant restructuring
• each transformation is small, less likely to
  go wrong
• system is kept fully working after each
  change
• verified by working tests
Code Coverage

comprehensiveness of tests
Beware!

comprehensiveness  quality!
Small Advice

Never measure
developers by
Code Coverage!
Demo
(Coverage in Eclipse)
Demo
 (Jenkins)
Continuous
Integration
Continuous Integration
•   Maintain a code repository
•   Automate the build
•   Make the build self-testing
•   Everyone commits every day
•   Every commit should be built
•   Keep the build fast
•   Everyone can see the results of the build
                http://en.wikipedia.org/wiki/Continuous_integration
Immediate Feedback
       and
  Early Warning
Demo
 (Jenkins)
2) Why should we use TDD?
• Writing tests takes time
• and we need to    deliver client
 value.
              I don't have time.
              I don't have time.
              I don't have time.
Do you still use that one?
Discussion
• What do you think are the benefits of
  TDD?
  – rapid feedback
  –…
  – ...
Benefits
• speed up
• coverage
  – measurable validation of correctness
• quality
  – proven to save maintenance costs
• creates a detailed specification
Benefits
• improve design
  – drive the design of a program
  – think in exposed API
Problems
• missing management
  buy-in
• high ramp-up time
• still need
  integration
  tests



http://watirmelon.com/2012/01/31/introducing-the-software-testing-ice-cream-cone/
TDD will not fix missing skills!
• badly written tests
  –   brittle
  –   blinking
  –   slow
  –   duplicate code
  –   maintenance burden
  –   wrong abstractions
  –   not really unit tests
Because TDD is hard!
• need to know OO,
  design, abstraction, ...
• new style of thinking
• need self-discipline
• (learning curve)
3) What you need to do
Problem Indicators: CI
• blinking builds
• builds broken for long time
• increasing build
  execution time
• decreasing code
  coverage
Problem Indicators: Tests
•   slow
•   fragile
•   no detailed feedback
•   “Ice-Cream Cone”
Problem Indicators: Developers
• claiming that they can't write tests
• claiming that they can't fix tests
• wanting to delete tests
“Buzzwords” Summary
• Techniques
  –   Unit Testing
  –   Test Driven Development
  –   Refactoring
  –   Code Coverage
  –   Continuous Integration
• Management Buy-In
• Keep an eye on the CI server
Support TDD



Do not compromise
  on techniques!
Thank
 You
Peter Kofler

  @codecopkofler

www.code-cop.org
CC Images
•   Drive: http://www.flickr.com/photos/hjem/367306587/
•   Judge: http://www.flickr.com/photos/eldave/6169431454/
•   List: http://www.flickr.com/photos/kylesteeddesign/3724074594/
•   Question mark: http://www.flickr.com/photos/oberazzi/318947873/
•   Fence: http://www.flickr.com/photos/30830597@N08/3630649274/
•   Coverage: http://www.flickr.com/photos/paulk/3166328163/
•   Works: http://www.codinghorror.com/blog/archives/000818.html
•   Cash: http://www.flickr.com/photos/mindfire/315274981/
•   Steep: http://www.flickr.com/photos/worldofoddy/229501642/
•   Want You: http://www.flickr.com/photos/shutter/105497713/
•   Warn: http://www.flickr.com/photos/hugosimmelink/2252095723/
•   Questions: http://www.flickr.com/photos/seandreilinger/2326448445/

More Related Content

What's hot

Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)Peter Kofler
 
Outside-in Test Driven Development - the London School of TDD
Outside-in Test Driven Development - the London School of TDDOutside-in Test Driven Development - the London School of TDD
Outside-in Test Driven Development - the London School of TDDPeter Kofler
 
Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Peter Kofler
 
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Peter Kofler
 
Designing Test Cases for the Gilded Rose Kata v2 (2015)
Designing Test Cases for the Gilded Rose Kata v2 (2015)Designing Test Cases for the Gilded Rose Kata v2 (2015)
Designing Test Cases for the Gilded Rose Kata v2 (2015)Peter Kofler
 
Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)Peter Kofler
 
Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)Peter Kofler
 
Idiomatic R for Rosetta Code (2013)
Idiomatic R for Rosetta Code (2013)Idiomatic R for Rosetta Code (2013)
Idiomatic R for Rosetta Code (2013)Peter Kofler
 
Extract Method Refactoring Workshop (2016)
Extract Method Refactoring Workshop (2016)Extract Method Refactoring Workshop (2016)
Extract Method Refactoring Workshop (2016)Peter Kofler
 
Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)Peter Kofler
 
Prime Factors Code Kata - Practicing TDD (2014)
Prime Factors Code Kata - Practicing TDD (2014)Prime Factors Code Kata - Practicing TDD (2014)
Prime Factors Code Kata - Practicing TDD (2014)Peter Kofler
 
Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)Peter Kofler
 
Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Peter Kofler
 
Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)Peter Kofler
 
JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)Peter Kofler
 
Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)Peter Kofler
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkPeter Kofler
 
Coding Dojo: Data Munging (2016)
Coding Dojo: Data Munging (2016)Coding Dojo: Data Munging (2016)
Coding Dojo: Data Munging (2016)Peter Kofler
 
Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Peter Kofler
 
Coding Dojo: Adding Tests to Legacy Code (2014)
Coding Dojo: Adding Tests to Legacy Code (2014)Coding Dojo: Adding Tests to Legacy Code (2014)
Coding Dojo: Adding Tests to Legacy Code (2014)Peter Kofler
 

What's hot (20)

Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)Deliberate Practice, New Learning Styles (2015)
Deliberate Practice, New Learning Styles (2015)
 
Outside-in Test Driven Development - the London School of TDD
Outside-in Test Driven Development - the London School of TDDOutside-in Test Driven Development - the London School of TDD
Outside-in Test Driven Development - the London School of TDD
 
Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)
 
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
 
Designing Test Cases for the Gilded Rose Kata v2 (2015)
Designing Test Cases for the Gilded Rose Kata v2 (2015)Designing Test Cases for the Gilded Rose Kata v2 (2015)
Designing Test Cases for the Gilded Rose Kata v2 (2015)
 
Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)
 
Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)
 
Idiomatic R for Rosetta Code (2013)
Idiomatic R for Rosetta Code (2013)Idiomatic R for Rosetta Code (2013)
Idiomatic R for Rosetta Code (2013)
 
Extract Method Refactoring Workshop (2016)
Extract Method Refactoring Workshop (2016)Extract Method Refactoring Workshop (2016)
Extract Method Refactoring Workshop (2016)
 
Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)
 
Prime Factors Code Kata - Practicing TDD (2014)
Prime Factors Code Kata - Practicing TDD (2014)Prime Factors Code Kata - Practicing TDD (2014)
Prime Factors Code Kata - Practicing TDD (2014)
 
Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)
 
Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)
 
Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)
 
JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)
 
Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
Coding Dojo: Data Munging (2016)
Coding Dojo: Data Munging (2016)Coding Dojo: Data Munging (2016)
Coding Dojo: Data Munging (2016)
 
Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)
 
Coding Dojo: Adding Tests to Legacy Code (2014)
Coding Dojo: Adding Tests to Legacy Code (2014)Coding Dojo: Adding Tests to Legacy Code (2014)
Coding Dojo: Adding Tests to Legacy Code (2014)
 

Similar to TDD and Related Techniques for Non Developers (2012)

Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersSPC Adriatics
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated TestingLars Thorup
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testingBestBrains
 
Topic production code
Topic production codeTopic production code
Topic production codeKavi Kumar
 
TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)Nacho Cougil
 
Lecture3.se.pptx
Lecture3.se.pptxLecture3.se.pptx
Lecture3.se.pptxAmna Ch
 
Unit testing and code review
Unit testing and code reviewUnit testing and code review
Unit testing and code reviewPavel Grushetzky
 
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)ssusercaf6c1
 
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)Nacho Cougil
 
TDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekTDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekNacho Cougil
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven developmentEinar Ingebrigtsen
 
Test Driven Development & CI/CD
Test Driven Development & CI/CDTest Driven Development & CI/CD
Test Driven Development & CI/CDShanmuga S Muthu
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentShawn Jones
 

Similar to TDD and Related Techniques for Non Developers (2012) (20)

Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill Ayers
 
Kku2011
Kku2011Kku2011
Kku2011
 
Kku2011
Kku2011Kku2011
Kku2011
 
CNUG TDD June 2014
CNUG TDD June 2014CNUG TDD June 2014
CNUG TDD June 2014
 
Introduction to Automated Testing
Introduction to Automated TestingIntroduction to Automated Testing
Introduction to Automated Testing
 
Introduction to-automated-testing
Introduction to-automated-testingIntroduction to-automated-testing
Introduction to-automated-testing
 
Topic production code
Topic production codeTopic production code
Topic production code
 
TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)
 
Lecture3.se.pptx
Lecture3.se.pptxLecture3.se.pptx
Lecture3.se.pptx
 
Unit testing and code review
Unit testing and code reviewUnit testing and code review
Unit testing and code review
 
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
 
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
 
Tdd
TddTdd
Tdd
 
Agile
AgileAgile
Agile
 
Agile engineering practices
Agile engineering practicesAgile engineering practices
Agile engineering practices
 
TDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech WeekTDD - Seriously, try it! - Bucarest Tech Week
TDD - Seriously, try it! - Bucarest Tech Week
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
Test Driven Development & CI/CD
Test Driven Development & CI/CDTest Driven Development & CI/CD
Test Driven Development & CI/CD
 
Introduction to Unit Tests and TDD
Introduction to Unit Tests and TDDIntroduction to Unit Tests and TDD
Introduction to Unit Tests and TDD
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
 

More from Peter Kofler

Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Peter Kofler
 
Refactoring the Tennis Kata v2 (2016)
Refactoring the Tennis Kata v2 (2016)Refactoring the Tennis Kata v2 (2016)
Refactoring the Tennis Kata v2 (2016)Peter Kofler
 
Designing Test Cases for the Gilded Rose Kata v3 (2016)
Designing Test Cases for the Gilded Rose Kata v3 (2016)Designing Test Cases for the Gilded Rose Kata v3 (2016)
Designing Test Cases for the Gilded Rose Kata v3 (2016)Peter Kofler
 
Coding Dojo: Asynchronous Clock-In (2016)
Coding Dojo: Asynchronous Clock-In (2016)Coding Dojo: Asynchronous Clock-In (2016)
Coding Dojo: Asynchronous Clock-In (2016)Peter Kofler
 
Mob Programming (2016)
Mob Programming (2016)Mob Programming (2016)
Mob Programming (2016)Peter Kofler
 
Code Retreat Venice (2016)
Code Retreat Venice (2016)Code Retreat Venice (2016)
Code Retreat Venice (2016)Peter Kofler
 
GDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran CanariaGDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran CanariaPeter Kofler
 
Pair Programming (2015)
Pair Programming (2015)Pair Programming (2015)
Pair Programming (2015)Peter Kofler
 
Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)Peter Kofler
 
Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Peter Kofler
 
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Peter Kofler
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Peter Kofler
 
Coding Dojo: Bank OCR (2014)
Coding Dojo: Bank OCR (2014)Coding Dojo: Bank OCR (2014)
Coding Dojo: Bank OCR (2014)Peter Kofler
 

More from Peter Kofler (13)

Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
 
Refactoring the Tennis Kata v2 (2016)
Refactoring the Tennis Kata v2 (2016)Refactoring the Tennis Kata v2 (2016)
Refactoring the Tennis Kata v2 (2016)
 
Designing Test Cases for the Gilded Rose Kata v3 (2016)
Designing Test Cases for the Gilded Rose Kata v3 (2016)Designing Test Cases for the Gilded Rose Kata v3 (2016)
Designing Test Cases for the Gilded Rose Kata v3 (2016)
 
Coding Dojo: Asynchronous Clock-In (2016)
Coding Dojo: Asynchronous Clock-In (2016)Coding Dojo: Asynchronous Clock-In (2016)
Coding Dojo: Asynchronous Clock-In (2016)
 
Mob Programming (2016)
Mob Programming (2016)Mob Programming (2016)
Mob Programming (2016)
 
Code Retreat Venice (2016)
Code Retreat Venice (2016)Code Retreat Venice (2016)
Code Retreat Venice (2016)
 
GDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran CanariaGDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran Canaria
 
Pair Programming (2015)
Pair Programming (2015)Pair Programming (2015)
Pair Programming (2015)
 
Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)
 
Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)
 
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)
 
Coding Dojo: Bank OCR (2014)
Coding Dojo: Bank OCR (2014)Coding Dojo: Bank OCR (2014)
Coding Dojo: Bank OCR (2014)
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 

Recently uploaded (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 

TDD and Related Techniques for Non Developers (2012)

  • 1. Test Driven Development and Related Techniques For Non-Developers ;-) IBM 2012 Peter Kofler, ‘Code Cop’ @codecopkofler www.code-cop.org Copyright Peter Kofler, licensed under CC-BY.
  • 2. Peter Kofler • Ph.D. (Appl. Math.) • (Java) Software Developer • with IBM since 1 year • SDM Costing, IGA, GBS
  • 3. The opinions expressed here are my own and do not necessarily represent those of current or past employers.
  • 4. Agenda 1) What does it look like? 2) Why is it important? 3) What you need to do! 4) Summary
  • 5. 1) So what is it all about? The Prime Factors Kata (Demo)
  • 6. What Exactly Will We Do Now? ● write code together ● using TDD ● see techniques and patterns ● discuss while doing
  • 7. The Requirements. • Write a class named “PrimeFactors” that has one static method: generate. – The generate method takes an integer argument and returns a List<Integer>. – That list contains the prime factors in numerical sequence. http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata
  • 8. First Some Math. ● Prime Number: a natural number > 1 that has no divisors other than 1 and itself. ● e.g. 2, 3, 5, 61, 67, ..., 997, ..., 243112609-1, … ● Prime Factors: the prime numbers that divide an integer exactly without remainder. ● e.g. 2 = 2, 4 = 2 * 2, 24 = 2 * 2 * 2 * 3 288 = 25 * 32
  • 9. The Requirements (for Mortals). • code a file/module/class “PrimeFactors” • code a function/method/routine “generate” • accept an integer number as parameter • return the prime factors of that number
  • 11. Keep the bar green to keep the code clean.
  • 12. Unit Testing • test individual units • isolate each part • show that the individual parts are correct • regression testing • sort of living documentation • executed within a framework http://en.wikipedia.org/wiki/Unit_testing
  • 13. Test-Driven Development • add a test • run all tests and see if the new one fails • write some code • run all tests and see them succeed • refactor code mercilessly • „Red Green Refactor“ http://en.wikipedia.org/wiki/Test_Driven_Development
  • 14. A minute ago all their code worked
  • 15. Refactoring Refactoring is a technique for restructuring an existing body of code, altering its internal structure without changing its external behavior. (Martin Fowler)
  • 16. Refactoring • small behavior preserving transformations • sequence of transformations produce a significant restructuring • each transformation is small, less likely to go wrong • system is kept fully working after each change • verified by working tests
  • 17.
  • 23.
  • 25. Continuous Integration • Maintain a code repository • Automate the build • Make the build self-testing • Everyone commits every day • Every commit should be built • Keep the build fast • Everyone can see the results of the build http://en.wikipedia.org/wiki/Continuous_integration
  • 26. Immediate Feedback and Early Warning
  • 28. 2) Why should we use TDD? • Writing tests takes time • and we need to deliver client value. I don't have time. I don't have time. I don't have time.
  • 29. Do you still use that one?
  • 30. Discussion • What do you think are the benefits of TDD? – rapid feedback –… – ...
  • 31. Benefits • speed up • coverage – measurable validation of correctness • quality – proven to save maintenance costs • creates a detailed specification
  • 32. Benefits • improve design – drive the design of a program – think in exposed API
  • 33. Problems • missing management buy-in • high ramp-up time • still need integration tests http://watirmelon.com/2012/01/31/introducing-the-software-testing-ice-cream-cone/
  • 34. TDD will not fix missing skills! • badly written tests – brittle – blinking – slow – duplicate code – maintenance burden – wrong abstractions – not really unit tests
  • 35. Because TDD is hard! • need to know OO, design, abstraction, ... • new style of thinking • need self-discipline • (learning curve)
  • 36. 3) What you need to do
  • 37. Problem Indicators: CI • blinking builds • builds broken for long time • increasing build execution time • decreasing code coverage
  • 38. Problem Indicators: Tests • slow • fragile • no detailed feedback • “Ice-Cream Cone”
  • 39. Problem Indicators: Developers • claiming that they can't write tests • claiming that they can't fix tests • wanting to delete tests
  • 40. “Buzzwords” Summary • Techniques – Unit Testing – Test Driven Development – Refactoring – Code Coverage – Continuous Integration • Management Buy-In • Keep an eye on the CI server
  • 41. Support TDD Do not compromise on techniques!
  • 43. Peter Kofler @codecopkofler www.code-cop.org
  • 44. CC Images • Drive: http://www.flickr.com/photos/hjem/367306587/ • Judge: http://www.flickr.com/photos/eldave/6169431454/ • List: http://www.flickr.com/photos/kylesteeddesign/3724074594/ • Question mark: http://www.flickr.com/photos/oberazzi/318947873/ • Fence: http://www.flickr.com/photos/30830597@N08/3630649274/ • Coverage: http://www.flickr.com/photos/paulk/3166328163/ • Works: http://www.codinghorror.com/blog/archives/000818.html • Cash: http://www.flickr.com/photos/mindfire/315274981/ • Steep: http://www.flickr.com/photos/worldofoddy/229501642/ • Want You: http://www.flickr.com/photos/shutter/105497713/ • Warn: http://www.flickr.com/photos/hugosimmelink/2252095723/ • Questions: http://www.flickr.com/photos/seandreilinger/2326448445/