SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Improving Design through
Test Driven Development (TDD)
     Sam Brown @SamuelBrownIV
     Mike McGarr @jmichaelmcgarr

    DC Agile Engineering Conference
               #DCAEC12
About Us
            Sam Brown                      Mike McGarr
•   11 years software engineer     • 11 years software engineer
•   DevOps Evangelist at Excella   • Directory of DevOps for
•   Certified Scrum Master           Blackboard Learn
•   Puppet Certified               • Founder of the DC
    Professional                     Continuous Integration,
                                     Delivery and Deployment
                                     Meetup
Types of Tests
Unit Tests

Fast
Independent
Repeatable
Self-Verifying
Timely
Test Driven Development
                                                                     Golden Rule of
                                                                     TDD:
                                                                     Never write
                                                                     production code
                                                                     without a failing
                                                                     test




 http://reddevnews.com/articles/2007/11/01/testdriven-development-tdd.aspx
TDD improves quality and
                                   design




http://www.manning.com/koskela2/
Coupling
Cohesion
Object Oriented Design Principles
  Single responsibility principle (SRP)

  Open/close principle (OCP)

  Liskov substitution principle (LSP)

  Interface segregation principle (ISP)

  Dependency inversion principle (DSP)
Bowling Game
• Ten Frames per game
• 2 rolls per frame
   • Unless a strike is rolled
• Properly calculate Spares
• Properly calculate Strikes
                                 http://playcasper.com/venues/show/17
Design
Decision
Design
Decision
Notice the duplication
  in the tests. Let’s
     refactor this.
More duplication
Design
                  Problem – roll()
                  calculates score




Let’s Refactor!
We need a concept of
      frames.
Ugly Code
Design Decisions
• Design client interface

• Refactor
     • Change design without changing behavior


• Defer to last responsible moment
     • Avoids “Big Upfront Design”
New Requirements!
Requested Changes
The Bowling game is becoming service oriented!

• New Requirement:
  – Post rolls in real-time
Collaborator
Test Doubles

•   Dummy
•   Stubs
•   Fake
•   Mocks
•   Spy
NullPointerException!
 We need a default
  implementation.
Contact Us
Sam Brown
samuel.brown@excella.com                 Cute Baby Arrival
@SamuelBrownIV                             12/20/2012
https://github.com/samueltbrown



                             •    J. Michael McGarr
                             •    jmcgarr@gmail.com
                             •    @jmichaelmcgarr
                             •    http://earlyandoften.wordpress.com
                             •    DC CI Meetup - http://bit.ly/YRnrwx

Weitere ähnliche Inhalte

Andere mochten auch

Scatol8 UUDD_livello A_5
Scatol8 UUDD_livello A_5Scatol8 UUDD_livello A_5
Scatol8 UUDD_livello A_5Scatol8
 
Overloading in java with example
Overloading in java with exampleOverloading in java with example
Overloading in java with examplekalkanpal
 
2015 寒假實習簡報 - 網站建置流程
2015 寒假實習簡報 - 網站建置流程2015 寒假實習簡報 - 網站建置流程
2015 寒假實習簡報 - 網站建置流程Mac Taylor
 
Bcg case competition team 2 final for linked_in
Bcg case competition team 2 final for linked_inBcg case competition team 2 final for linked_in
Bcg case competition team 2 final for linked_inNaian Chang
 
Larry Logan Live Webinar: Winning Customer Loyalty Through Digitally Empowere...
Larry Logan Live Webinar: Winning Customer Loyalty Through Digitally Empowere...Larry Logan Live Webinar: Winning Customer Loyalty Through Digitally Empowere...
Larry Logan Live Webinar: Winning Customer Loyalty Through Digitally Empowere...SGK
 
26598353 laporan-kerja-milling-2
26598353 laporan-kerja-milling-226598353 laporan-kerja-milling-2
26598353 laporan-kerja-milling-2Muiz Rosli
 
Sistem tagal
Sistem tagalSistem tagal
Sistem tagalsutang
 
Spaeth claritypp002W
Spaeth claritypp002WSpaeth claritypp002W
Spaeth claritypp002Wkevinspaeth25
 
Scatol8 UUDD livello A_1
Scatol8 UUDD livello A_1Scatol8 UUDD livello A_1
Scatol8 UUDD livello A_1Scatol8
 
ECO-ARREDI: ARREDO COMFORT BENESSERE SU MISURA DA MATRICI NATURALI SOSTENIBIL...
ECO-ARREDI: ARREDO COMFORT BENESSERE SU MISURA DA MATRICI NATURALI SOSTENIBIL...ECO-ARREDI: ARREDO COMFORT BENESSERE SU MISURA DA MATRICI NATURALI SOSTENIBIL...
ECO-ARREDI: ARREDO COMFORT BENESSERE SU MISURA DA MATRICI NATURALI SOSTENIBIL...Scatol8
 
IoT and Management Systems: new dimensions for research and didactics towards...
IoT and Management Systems: new dimensions for research and didactics towards...IoT and Management Systems: new dimensions for research and didactics towards...
IoT and Management Systems: new dimensions for research and didactics towards...Scatol8
 
Coffee Shop Security Group Tool
Coffee Shop Security Group ToolCoffee Shop Security Group Tool
Coffee Shop Security Group Tooljoehack3r
 

Andere mochten auch (20)

lecture(1)
lecture(1)lecture(1)
lecture(1)
 
Kcw rb
Kcw rbKcw rb
Kcw rb
 
Scatol8 UUDD_livello A_5
Scatol8 UUDD_livello A_5Scatol8 UUDD_livello A_5
Scatol8 UUDD_livello A_5
 
Overloading in java with example
Overloading in java with exampleOverloading in java with example
Overloading in java with example
 
وسل أبها
وسل أبهاوسل أبها
وسل أبها
 
2015 寒假實習簡報 - 網站建置流程
2015 寒假實習簡報 - 網站建置流程2015 寒假實習簡報 - 網站建置流程
2015 寒假實習簡報 - 網站建置流程
 
Bcg case competition team 2 final for linked_in
Bcg case competition team 2 final for linked_inBcg case competition team 2 final for linked_in
Bcg case competition team 2 final for linked_in
 
Larry Logan Live Webinar: Winning Customer Loyalty Through Digitally Empowere...
Larry Logan Live Webinar: Winning Customer Loyalty Through Digitally Empowere...Larry Logan Live Webinar: Winning Customer Loyalty Through Digitally Empowere...
Larry Logan Live Webinar: Winning Customer Loyalty Through Digitally Empowere...
 
26598353 laporan-kerja-milling-2
26598353 laporan-kerja-milling-226598353 laporan-kerja-milling-2
26598353 laporan-kerja-milling-2
 
Trabajo grupal
Trabajo grupalTrabajo grupal
Trabajo grupal
 
Awareness on public school education
Awareness on public school educationAwareness on public school education
Awareness on public school education
 
Sistem tagal
Sistem tagalSistem tagal
Sistem tagal
 
Spaeth claritypp002W
Spaeth claritypp002WSpaeth claritypp002W
Spaeth claritypp002W
 
Tmđt
TmđtTmđt
Tmđt
 
Scatol8 UUDD livello A_1
Scatol8 UUDD livello A_1Scatol8 UUDD livello A_1
Scatol8 UUDD livello A_1
 
Saludos navideños docentes
Saludos navideños docentesSaludos navideños docentes
Saludos navideños docentes
 
ECO-ARREDI: ARREDO COMFORT BENESSERE SU MISURA DA MATRICI NATURALI SOSTENIBIL...
ECO-ARREDI: ARREDO COMFORT BENESSERE SU MISURA DA MATRICI NATURALI SOSTENIBIL...ECO-ARREDI: ARREDO COMFORT BENESSERE SU MISURA DA MATRICI NATURALI SOSTENIBIL...
ECO-ARREDI: ARREDO COMFORT BENESSERE SU MISURA DA MATRICI NATURALI SOSTENIBIL...
 
Feliz dia del maestro.pptx rr
Feliz dia del maestro.pptx rrFeliz dia del maestro.pptx rr
Feliz dia del maestro.pptx rr
 
IoT and Management Systems: new dimensions for research and didactics towards...
IoT and Management Systems: new dimensions for research and didactics towards...IoT and Management Systems: new dimensions for research and didactics towards...
IoT and Management Systems: new dimensions for research and didactics towards...
 
Coffee Shop Security Group Tool
Coffee Shop Security Group ToolCoffee Shop Security Group Tool
Coffee Shop Security Group Tool
 

Ähnlich wie Improving Design through TDD

JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit TestingKeir Bowden
 
SanDiego_DevOps_Meetup_9212016-v8
SanDiego_DevOps_Meetup_9212016-v8SanDiego_DevOps_Meetup_9212016-v8
SanDiego_DevOps_Meetup_9212016-v8Rajwinder Singh
 
SanDiego_DevOps_Meetup_9212016
SanDiego_DevOps_Meetup_9212016SanDiego_DevOps_Meetup_9212016
SanDiego_DevOps_Meetup_9212016w2fong
 
Managing Software Debt - Quality Debt Focus - QASIG Kirkland
Managing Software Debt - Quality Debt Focus - QASIG KirklandManaging Software Debt - Quality Debt Focus - QASIG Kirkland
Managing Software Debt - Quality Debt Focus - QASIG KirklandChris Sterling
 
Scaling Continuous Integration Practices to Teams with Parallel Development
Scaling Continuous Integration Practices to Teams with Parallel DevelopmentScaling Continuous Integration Practices to Teams with Parallel Development
Scaling Continuous Integration Practices to Teams with Parallel DevelopmentIBM UrbanCode Products
 
Production - Designing for Testability
Production - Designing for TestabilityProduction - Designing for Testability
Production - Designing for TestabilityMichael Bryzek
 
Inside Behavior Driven Development
Inside Behavior Driven DevelopmentInside Behavior Driven Development
Inside Behavior Driven DevelopmentCamille Bell
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit TestingShaun Abram
 
TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)Peter Kofler
 
What CS Class Didn't Teach About Testing
What CS Class Didn't Teach About TestingWhat CS Class Didn't Teach About Testing
What CS Class Didn't Teach About TestingCamille Bell
 
Behavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineBehavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineRemus Langu
 
BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!
BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!
BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!Andreas Grabner
 
Using Multi-stage Docker, Go, Java,& Bazel to DESTROY Long Build Times
Using Multi-stage Docker, Go, Java,& Bazel to DESTROY Long Build TimesUsing Multi-stage Docker, Go, Java,& Bazel to DESTROY Long Build Times
Using Multi-stage Docker, Go, Java,& Bazel to DESTROY Long Build TimesDevOps.com
 
Continuous Integration, the minimum viable product
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable productJulian Simpson
 
Ruin your life using robot framework
Ruin your life using robot frameworkRuin your life using robot framework
Ruin your life using robot frameworkPrayoch Rujira
 
Metrics-driven Continuous Delivery
Metrics-driven Continuous DeliveryMetrics-driven Continuous Delivery
Metrics-driven Continuous DeliveryAndrew Phillips
 
Continuous delivery applied (RJUG)
Continuous delivery applied (RJUG)Continuous delivery applied (RJUG)
Continuous delivery applied (RJUG)Mike McGarr
 
Deploy Angular to the Cloud
Deploy Angular to the CloudDeploy Angular to the Cloud
Deploy Angular to the CloudSimona Cotin
 
CodeOne 2018 - Better software, faster: principles of Continuous Delivery and...
CodeOne 2018 - Better software, faster: principles of Continuous Delivery and...CodeOne 2018 - Better software, faster: principles of Continuous Delivery and...
CodeOne 2018 - Better software, faster: principles of Continuous Delivery and...Bert Jan Schrijver
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Danny Preussler
 

Ähnlich wie Improving Design through TDD (20)

JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
SanDiego_DevOps_Meetup_9212016-v8
SanDiego_DevOps_Meetup_9212016-v8SanDiego_DevOps_Meetup_9212016-v8
SanDiego_DevOps_Meetup_9212016-v8
 
SanDiego_DevOps_Meetup_9212016
SanDiego_DevOps_Meetup_9212016SanDiego_DevOps_Meetup_9212016
SanDiego_DevOps_Meetup_9212016
 
Managing Software Debt - Quality Debt Focus - QASIG Kirkland
Managing Software Debt - Quality Debt Focus - QASIG KirklandManaging Software Debt - Quality Debt Focus - QASIG Kirkland
Managing Software Debt - Quality Debt Focus - QASIG Kirkland
 
Scaling Continuous Integration Practices to Teams with Parallel Development
Scaling Continuous Integration Practices to Teams with Parallel DevelopmentScaling Continuous Integration Practices to Teams with Parallel Development
Scaling Continuous Integration Practices to Teams with Parallel Development
 
Production - Designing for Testability
Production - Designing for TestabilityProduction - Designing for Testability
Production - Designing for Testability
 
Inside Behavior Driven Development
Inside Behavior Driven DevelopmentInside Behavior Driven Development
Inside Behavior Driven Development
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit Testing
 
TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)
 
What CS Class Didn't Teach About Testing
What CS Class Didn't Teach About TestingWhat CS Class Didn't Teach About Testing
What CS Class Didn't Teach About Testing
 
Behavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineBehavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & Jasmine
 
BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!
BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!
BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!
 
Using Multi-stage Docker, Go, Java,& Bazel to DESTROY Long Build Times
Using Multi-stage Docker, Go, Java,& Bazel to DESTROY Long Build TimesUsing Multi-stage Docker, Go, Java,& Bazel to DESTROY Long Build Times
Using Multi-stage Docker, Go, Java,& Bazel to DESTROY Long Build Times
 
Continuous Integration, the minimum viable product
Continuous Integration, the minimum viable productContinuous Integration, the minimum viable product
Continuous Integration, the minimum viable product
 
Ruin your life using robot framework
Ruin your life using robot frameworkRuin your life using robot framework
Ruin your life using robot framework
 
Metrics-driven Continuous Delivery
Metrics-driven Continuous DeliveryMetrics-driven Continuous Delivery
Metrics-driven Continuous Delivery
 
Continuous delivery applied (RJUG)
Continuous delivery applied (RJUG)Continuous delivery applied (RJUG)
Continuous delivery applied (RJUG)
 
Deploy Angular to the Cloud
Deploy Angular to the CloudDeploy Angular to the Cloud
Deploy Angular to the Cloud
 
CodeOne 2018 - Better software, faster: principles of Continuous Delivery and...
CodeOne 2018 - Better software, faster: principles of Continuous Delivery and...CodeOne 2018 - Better software, faster: principles of Continuous Delivery and...
CodeOne 2018 - Better software, faster: principles of Continuous Delivery and...
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 

Mehr von DC Agile Engineering Conference (6)

Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy Code
 
Unindented Code Cannot Possibly Work
Unindented Code Cannot Possibly WorkUnindented Code Cannot Possibly Work
Unindented Code Cannot Possibly Work
 
Lead by Example
Lead by ExampleLead by Example
Lead by Example
 
Continuous Integration: Toolbox, Blueprint, Master Craft
Continuous Integration: Toolbox, Blueprint, Master CraftContinuous Integration: Toolbox, Blueprint, Master Craft
Continuous Integration: Toolbox, Blueprint, Master Craft
 
Continuous Delivery Applied
Continuous Delivery AppliedContinuous Delivery Applied
Continuous Delivery Applied
 
Agile Engineering and Software Craftsmanship
Agile Engineering and Software CraftsmanshipAgile Engineering and Software Craftsmanship
Agile Engineering and Software Craftsmanship
 

Kürzlich hochgeladen

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Improving Design through TDD

Hinweis der Redaktion

  1. Mike
  2. (Mike)Fast – runs in less than 1/10 secondIndependent– test one thing only (single assert)Repeatable – reliably repeatable (no external dependencies)Self-Verifying – red or green…no human interpretationTimely – test written before production code
  3. (Sam)Red-Green-RefactorRefactoring – changing code without changing behaviorGolden Rule of TDD: Never write production code without a failing test
  4. (Sam)Unit testing alone helps focus on qualityQuality only unit testing has limitsTDD allows developers to also improve design, increasing the value of testsLasseKoskela calls this the law of two plateausTransition to Advantage:Commonly understood advantage: QualityLess known: Improving DesignAdditional Voice Track: As we approach 100% coverage, effort to achieve small increases in coverage are greater than the value returned
  5. (Mike)Metrics of maintainability:Coupled Elements – A change in one forces a change in another (want loose coupling)Inheritance vs. Interface
  6. (Sam)Coherence – a measure of whether an element’s responsibility form a meaningful unit.Do one thing only-Animation to show first class, then divided out- What the heck is ‘coherence’???
  7. SRP – do one thing only (coherence)OCP – objects should be open for extension/closed for modificationLSP – objects should be replaceable by sub-types (design by contract)ISP – many client specific interfaces are better than one multi-purpose oneDSP – depend on abstractions and not concrete classes (dependency inversion)
  8. Calculate score for bowlsUnderstand sparesUnderstand strikes
  9. Test to ensure JUnit is working
  10. First design decision
  11. Only going to talk about Stubs and MocksDummy – objects that are passed but never usedStubs – pre-canned answers to method callsFake – scaled down version of production (InMemoryDB)Mocks – set expectationsSpy – records information passed to it
  12. Introduce a new test
  13. 1. ImportMockito (discuss what it is)2. Declare interface and use Mockito to mock3. Define dependency injection of RollNotificationService4. Then,…roll5. Verify that the mock RollNotificationService’s publish method was called once
  14. We create the new interfaceTest still failsIf we look at the unit test, the Game object needs to be updated
  15. We now update the Game with dependencySOLID – Dependency InversionTest still failsOur interface needs a new publish method
  16. We add method to interfaceTest still failsWe’ve resolved all compilation errorsThe roll() method never calls publish!The error we get is different…not an assertion
  17. Add the call to the serviceTest fails! (Huh?!)All other tests fail due to NullPointerException(Emphasize how powerful this fast feedback is on regressions)
  18. Created a new default implementation(would likely not do this in production…let me know if we should change to another type or demand)