SlideShare uma empresa Scribd logo
1 de 36
Baixar para ler offline
Piccolo Coding Dojo
                              XPUG Milano 10 aprile 2013
                                   Andrea Francia
                                http://andreafrancia.it




Thursday, April 11, 13
Timetable

                         • A short review of TDD (1pom)
                         • Practice with TDD (2pom)
                         • Retrospective (1pom)


Thursday, April 11, 13
Test Driven
                         Development


Thursday, April 11, 13
The heart of TDD

                         1. write a test
                         2. watch it fail
                         3. make it pass
                         4. repeat




Thursday, April 11, 13
Example: calculator



Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Example: file name
                            extension


Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Thursday, April 11, 13
Three Rules of TDD
                         1. You can’t write any production code
                            unless is to make green a red test
                         2. You can’t add more code to a test than is
                            sufficient to make it red
                         3. You can’t write more production code than
                            is sufficient to make the test green

        http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
Thursday, April 11, 13
Refactoring (def ):
                         improving design without
                         changing its observable behavior.




Thursday, April 11, 13
Refactoring (when)
                                    make it
                                        pass


                     write
                         •
                    another the Green
                       During
                        test

                                               refactor



Thursday, April 11, 13
Simple Design
                         A design is simple when:
                         1. pass all tests
                         2. contains no duplication
                         3. express the intent
                         4. minimal, nothing superfluous


                         http://c2.com/cgi/wiki?XpSimplicityRules
Thursday, April 11, 13
What is not unit test?
                          A test is not a unit test if:
                          1. It talks to a database.
                          2. It communicates across a network.
                          3. It touches the file system.
                          4. Requires some manual set-up

        Working Effectively with Legacy Code - Michael Feathers
Thursday, April 11, 13
Thursday, April 11, 13
Grazie



Thursday, April 11, 13
Domande?



Thursday, April 11, 13
Game of Life



Thursday, April 11, 13
THE GAME OF LIFE
                                            IS A TWO
                                      DIMENSIONAL GRID
                                      OF SQUARE CELLS
                                      EACH OF WHICH IS
                                        IN ONE OF TWO
                                      POSSIBLE STATES
                                        ALIVE OR DEAD

             http://www.slideshare.net/gabriele.lana/coderetreat

Thursday, April 11, 13
AT EACH STEP IN
                                       TIME EVERY CELL
                                       INTERACTS WITH
                                       ITS 8 NEIGHBORS
                                         FOLLOWING 3
                                             RULES

             http://www.slideshare.net/gabriele.lana/coderetreat

Thursday, April 11, 13
1. ANY LIVE CELL WITH FEWER THAN 2
     LIVE NEIGHBORS DIES OF LONELINESS




             http://www.slideshare.net/gabriele.lana/coderetreat
Thursday, April 11, 13
2. ANY LIVE CELL WITH MORE
         THAN 3 LIVE NEIGHBORS
        DIES OF OVERCROWDING




             http://www.slideshare.net/gabriele.lana/coderetreat
Thursday, April 11, 13
3. ANY DEAD CELL WITH
         EXACTLY 3 LIVE NEIGHBORS
         COMES TO LIFE OF WARMTH




             http://www.slideshare.net/gabriele.lana/coderetreat
Thursday, April 11, 13
LIFE EVOLUTION
                         1       2            3




             http://www.slideshare.net/gabriele.lana/coderetreat
Thursday, April 11, 13
LIFE EVOLUTION
                         1       2           3




           http://www.slideshare.net/gabriele.lana/coderetreat
Thursday, April 11, 13
LIFE EVOLUTION
                         1    2              3




           http://www.slideshare.net/gabriele.lana/coderetreat
Thursday, April 11, 13

Mais conteúdo relacionado

Mais de Andrea Francia

Writing a Crawler with Python and TDD
Writing a Crawler with Python and TDDWriting a Crawler with Python and TDD
Writing a Crawler with Python and TDD
Andrea Francia
 
Subversion @ JUG Milano 11 dic 2009
Subversion @ JUG Milano 11 dic 2009Subversion @ JUG Milano 11 dic 2009
Subversion @ JUG Milano 11 dic 2009
Andrea Francia
 

Mais de Andrea Francia (18)

Baby Steps TripServiceKata
Baby Steps TripServiceKataBaby Steps TripServiceKata
Baby Steps TripServiceKata
 
TDD on Legacy Code - Voxxed Days Milano 2019
TDD on Legacy Code - Voxxed Days Milano 2019TDD on Legacy Code - Voxxed Days Milano 2019
TDD on Legacy Code - Voxxed Days Milano 2019
 
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...
 
Kata in Bash a DevOpsHeroes 2018 a Parma
Kata in Bash a DevOpsHeroes 2018 a ParmaKata in Bash a DevOpsHeroes 2018 a Parma
Kata in Bash a DevOpsHeroes 2018 a Parma
 
User Stories - Andrea Francia @ WeDev 7 novembre 2018
User Stories - Andrea Francia @ WeDev 7 novembre 2018User Stories - Andrea Francia @ WeDev 7 novembre 2018
User Stories - Andrea Francia @ WeDev 7 novembre 2018
 
Le pratiche ingegneristiche di eXtreme Programming
Le pratiche ingegneristiche di eXtreme ProgrammingLe pratiche ingegneristiche di eXtreme Programming
Le pratiche ingegneristiche di eXtreme Programming
 
Test-Driven Development su Codice Esistente
Test-Driven Development su Codice EsistenteTest-Driven Development su Codice Esistente
Test-Driven Development su Codice Esistente
 
Come si applica l'OCP
Come si applica l'OCPCome si applica l'OCP
Come si applica l'OCP
 
Le 12 pratiche - Un introduzione a XP (Mini Italian Agile Day)
Le 12 pratiche - Un introduzione a XP (Mini Italian Agile Day)Le 12 pratiche - Un introduzione a XP (Mini Italian Agile Day)
Le 12 pratiche - Un introduzione a XP (Mini Italian Agile Day)
 
Introduzione a eXtreme Programming
Introduzione a eXtreme ProgrammingIntroduzione a eXtreme Programming
Introduzione a eXtreme Programming
 
Bash-Only Deployment
Bash-Only DeploymentBash-Only Deployment
Bash-Only Deployment
 
TDD anche su iOS
TDD anche su iOSTDD anche su iOS
TDD anche su iOS
 
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG miTutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
 
Writing a Crawler with Python and TDD
Writing a Crawler with Python and TDDWriting a Crawler with Python and TDD
Writing a Crawler with Python and TDD
 
Introduzione al TDD
Introduzione al TDDIntroduzione al TDD
Introduzione al TDD
 
Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008
 
Subversion @ JUG Milano 11 dic 2009
Subversion @ JUG Milano 11 dic 2009Subversion @ JUG Milano 11 dic 2009
Subversion @ JUG Milano 11 dic 2009
 
Working Effectively with Legacy Code (draft)
Working Effectively with Legacy Code (draft)Working Effectively with Legacy Code (draft)
Working Effectively with Legacy Code (draft)
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Piccolo coding dojo (milano xpug 2013-04-11)