SlideShare uma empresa Scribd logo
1 de 22
Test Driving Legacy Code
Breaking out of the “Legacy Code Dilemma”
About me…
Developer since 1994
(C++ used to be my friend…)
Agile Coach since 2009
fernando.a.cuenca@gmail.com
@fer_cuenca
Big Thanks to our
Sponsor!
http://digitalfactory.scotiabank.com
Agenda
TDD in the context of Legacy Code
Practice Session 1 + Debrief
BREAK
Practice Session 2 + Debrief
So, what is “Legacy Code”
anyways?
Code that
actively prevents
you from making
changes
Code we’re
afraid to change
Code where the
design makes
more design
decisions than
the programmer
Code without
Unit Tests
you could
have a
“magic
button”…
Pecha Kucha @ OOP 2015 "Is TDD dead?
https://www.youtube.com/watch?v=9NANcPTbDBQ
Start
Here
TDD
Write a
failing
test
Make it
pass
Improve
the
Design
The Legacy Code Dilemma
Michael Feathers
“Working Effectively with Legacy Code”
Pinning Down
Behaviour
Your turn now!
2 Practice sessions + Debrief
We need to choose a common Programming
Language
Java
C#
Javascript
Find a partner (we’ll switch for Session 2)
Log in to my Cyber-Dojo:
http://cyberdojo.ddns.net
Welcome to Ugly Trivia!
What does the code do?
What are the different RESPONSIBILITIES?
How “good” or “bad” is this code? Why?
How much “Technical Debt” does it have?
Can you identify two distinct kinds of tests?
What is the purpose of each?
Key Ideas
Adding More Characterization
Tests
What kinds of things are displayed? When?
What’s the minimum number of players?
What happens when a player rolls?
How does the current location change?
How are categories selected?
How are coins awarded?
What’s the order of the players?
How big is the board? How is it traversed?
What happens when the answer is correct?
Incorrect?
What are the rules around the “penalty box”?
Debrief: What was it like?
What are most important insights you gained
from the session?
What was helpful / not-helpful?
What will you do differently in the next session?
Let’s fix some defects!
Fix typo when answering correctly ("Answer was
corrent")
Terminate nicely instead of throwing exceptions:
when questions run out
when rolling before adding players
Let’s add some new
features!
Backlog
1. Display the winner's
name when the game
ends
2. Display output in
multiple languages
Guidelines
Cover, then modify
Can you test-drive a
replacement?
Are your tests passing
all the time?
How small are your
steps? Can you make
them smaller?
Large-Scale Refactoring
New Features
1. Configurable board size
2. New Category: Politics
3. When questions run out (in
any category), the game ends
and the player with the most
coins wins
4. Different categories pay
different amount of coins
when answered correctly
5. if 2 people in a row answer
incorrectly, the order of
players inverts
Guidelines
Pick a feature to work
on
Agree on a “good
design” for it.
Sketch general
incremental steps to
get there
The Mikado Method (https://mikadomethod.wordpress.com)
Debrief: What was it like?
What are most important insights you gained
from this session?
What was the overall feeling?
How does the result compares to what you
initially thought the outcome might be?
How/Where could this approach be useful?
What will you do differently tomorrow, back in the
office?
Learning more
Thank you!
And please, complete the feedback forms!!

Mais conteúdo relacionado

Semelhante a Test Driving Legacy Code Mini Workshop

Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018David Völkel
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019Paulo Clavijo
 
Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017David Völkel
 
sitHVR - The Hitchhikers Guide to the Legacy
sitHVR - The Hitchhikers Guide to the LegacysitHVR - The Hitchhikers Guide to the Legacy
sitHVR - The Hitchhikers Guide to the LegacyLaurens van Rijn
 
sitBRU - The Hitchhikers Guide to the Legacy
sitBRU - The Hitchhikers Guide to the LegacysitBRU - The Hitchhikers Guide to the Legacy
sitBRU - The Hitchhikers Guide to the LegacyLaurens van Rijn
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
 
InfoSession2022_merged.pdf
InfoSession2022_merged.pdfInfoSession2022_merged.pdf
InfoSession2022_merged.pdfKINGSHUKGHOSH20
 
Agile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovAgile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovSvetlin Nakov
 
Agile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingAgile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingUtkarsh Khare
 
DevLearn 2017 Play to Learn workshop slides
DevLearn 2017 Play to Learn workshop slidesDevLearn 2017 Play to Learn workshop slides
DevLearn 2017 Play to Learn workshop slidesSharon Boller
 
Coding Dojo Firenze - vol1
Coding Dojo Firenze - vol1 Coding Dojo Firenze - vol1
Coding Dojo Firenze - vol1 Massimo Iacolare
 
Greythorn Whiteboard Interview Guide
Greythorn Whiteboard Interview GuideGreythorn Whiteboard Interview Guide
Greythorn Whiteboard Interview GuideVaco Seattle
 
Kata Your Way to SW Craftsmanship
Kata Your Way to SW CraftsmanshipKata Your Way to SW Craftsmanship
Kata Your Way to SW CraftsmanshipCamille Bell
 
How to Design Effective Learning Games: Sharon Boller and Karl Kapp
How to Design Effective Learning Games: Sharon Boller and Karl KappHow to Design Effective Learning Games: Sharon Boller and Karl Kapp
How to Design Effective Learning Games: Sharon Boller and Karl KappSharon Boller
 

Semelhante a Test Driving Legacy Code Mini Workshop (20)

Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018
 
Make a better with clean code
Make a better with clean codeMake a better with clean code
Make a better with clean code
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017
 
Code Retreat
Code RetreatCode Retreat
Code Retreat
 
sitHVR - The Hitchhikers Guide to the Legacy
sitHVR - The Hitchhikers Guide to the LegacysitHVR - The Hitchhikers Guide to the Legacy
sitHVR - The Hitchhikers Guide to the Legacy
 
sitBRU - The Hitchhikers Guide to the Legacy
sitBRU - The Hitchhikers Guide to the LegacysitBRU - The Hitchhikers Guide to the Legacy
sitBRU - The Hitchhikers Guide to the Legacy
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....
 
InfoSession2022_merged.pdf
InfoSession2022_merged.pdfInfoSession2022_merged.pdf
InfoSession2022_merged.pdf
 
Agile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovAgile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin Nakov
 
Agile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingAgile Methodologies And Extreme Programming
Agile Methodologies And Extreme Programming
 
DevLearn 2017 Play to Learn workshop slides
DevLearn 2017 Play to Learn workshop slidesDevLearn 2017 Play to Learn workshop slides
DevLearn 2017 Play to Learn workshop slides
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Coding Dojo Firenze - vol1
Coding Dojo Firenze - vol1 Coding Dojo Firenze - vol1
Coding Dojo Firenze - vol1
 
Best pratice
Best praticeBest pratice
Best pratice
 
Agile Practices
Agile PracticesAgile Practices
Agile Practices
 
Greythorn Whiteboard Interview Guide
Greythorn Whiteboard Interview GuideGreythorn Whiteboard Interview Guide
Greythorn Whiteboard Interview Guide
 
Kata Your Way to SW Craftsmanship
Kata Your Way to SW CraftsmanshipKata Your Way to SW Craftsmanship
Kata Your Way to SW Craftsmanship
 
Raising the Bar
Raising the BarRaising the Bar
Raising the Bar
 
How to Design Effective Learning Games: Sharon Boller and Karl Kapp
How to Design Effective Learning Games: Sharon Boller and Karl KappHow to Design Effective Learning Games: Sharon Boller and Karl Kapp
How to Design Effective Learning Games: Sharon Boller and Karl Kapp
 

Mais de Fernando Cuenca

Kanban: More than boards and WIP limits
Kanban: More than boards and WIP limitsKanban: More than boards and WIP limits
Kanban: More than boards and WIP limitsFernando Cuenca
 
Kanban: mucho Mas que tableros y Limites de WIP
Kanban: mucho Mas que tableros y Limites de WIPKanban: mucho Mas que tableros y Limites de WIP
Kanban: mucho Mas que tableros y Limites de WIPFernando Cuenca
 
Finding your Service Delivery Manager
Finding your Service Delivery ManagerFinding your Service Delivery Manager
Finding your Service Delivery ManagerFernando Cuenca
 
Agile Dependencies: When "going cross-functional" is not an option
Agile Dependencies: When "going cross-functional" is not an optionAgile Dependencies: When "going cross-functional" is not an option
Agile Dependencies: When "going cross-functional" is not an optionFernando Cuenca
 
Kanban in The Land of Scrum: Choose your Own Scrumban Adventure
Kanban in The Land of Scrum: Choose your Own Scrumban AdventureKanban in The Land of Scrum: Choose your Own Scrumban Adventure
Kanban in The Land of Scrum: Choose your Own Scrumban AdventureFernando Cuenca
 
From Team Flow to System Flow to Customer Flow: Practical Tools to Keep Valua...
From Team Flow to System Flow to Customer Flow: Practical Tools to Keep Valua...From Team Flow to System Flow to Customer Flow: Practical Tools to Keep Valua...
From Team Flow to System Flow to Customer Flow: Practical Tools to Keep Valua...Fernando Cuenca
 
Your board is trying to tell you something
Your board is trying to tell you somethingYour board is trying to tell you something
Your board is trying to tell you somethingFernando Cuenca
 
AgileLunch Meetup - Listen to your Board
AgileLunch Meetup - Listen to your BoardAgileLunch Meetup - Listen to your Board
AgileLunch Meetup - Listen to your BoardFernando Cuenca
 
Visualizing Work: If you can't see it, you can't manage it
Visualizing Work: If you can't see it, you can't manage itVisualizing Work: If you can't see it, you can't manage it
Visualizing Work: If you can't see it, you can't manage itFernando Cuenca
 
Kanban to #003 - Metrics
Kanban to #003 - MetricsKanban to #003 - Metrics
Kanban to #003 - MetricsFernando Cuenca
 
Amp up your Agile Implementation with Systems Thinking
Amp up your Agile Implementation with Systems ThinkingAmp up your Agile Implementation with Systems Thinking
Amp up your Agile Implementation with Systems ThinkingFernando Cuenca
 

Mais de Fernando Cuenca (15)

Kanban: More than boards and WIP limits
Kanban: More than boards and WIP limitsKanban: More than boards and WIP limits
Kanban: More than boards and WIP limits
 
El Pivot Pragmatico
El Pivot PragmaticoEl Pivot Pragmatico
El Pivot Pragmatico
 
Kanban: mucho Mas que tableros y Limites de WIP
Kanban: mucho Mas que tableros y Limites de WIPKanban: mucho Mas que tableros y Limites de WIP
Kanban: mucho Mas que tableros y Limites de WIP
 
Finding your SDM
Finding your SDMFinding your SDM
Finding your SDM
 
Finding your Service Delivery Manager
Finding your Service Delivery ManagerFinding your Service Delivery Manager
Finding your Service Delivery Manager
 
Agile Dependencies: When "going cross-functional" is not an option
Agile Dependencies: When "going cross-functional" is not an optionAgile Dependencies: When "going cross-functional" is not an option
Agile Dependencies: When "going cross-functional" is not an option
 
Kanban in The Land of Scrum: Choose your Own Scrumban Adventure
Kanban in The Land of Scrum: Choose your Own Scrumban AdventureKanban in The Land of Scrum: Choose your Own Scrumban Adventure
Kanban in The Land of Scrum: Choose your Own Scrumban Adventure
 
From Team Flow to System Flow to Customer Flow: Practical Tools to Keep Valua...
From Team Flow to System Flow to Customer Flow: Practical Tools to Keep Valua...From Team Flow to System Flow to Customer Flow: Practical Tools to Keep Valua...
From Team Flow to System Flow to Customer Flow: Practical Tools to Keep Valua...
 
Que tan agiles somos?
Que tan agiles somos?Que tan agiles somos?
Que tan agiles somos?
 
Your board is trying to tell you something
Your board is trying to tell you somethingYour board is trying to tell you something
Your board is trying to tell you something
 
AgileLunch Meetup - Listen to your Board
AgileLunch Meetup - Listen to your BoardAgileLunch Meetup - Listen to your Board
AgileLunch Meetup - Listen to your Board
 
Visualizing Work: If you can't see it, you can't manage it
Visualizing Work: If you can't see it, you can't manage itVisualizing Work: If you can't see it, you can't manage it
Visualizing Work: If you can't see it, you can't manage it
 
Kanban to #003 - Metrics
Kanban to #003 - MetricsKanban to #003 - Metrics
Kanban to #003 - Metrics
 
Amp up your Agile Implementation with Systems Thinking
Amp up your Agile Implementation with Systems ThinkingAmp up your Agile Implementation with Systems Thinking
Amp up your Agile Implementation with Systems Thinking
 
Basic TDD moves
Basic TDD movesBasic TDD moves
Basic TDD moves
 

Último

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 

Último (20)

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

Test Driving Legacy Code Mini Workshop

  • 1. Test Driving Legacy Code Breaking out of the “Legacy Code Dilemma”
  • 2. About me… Developer since 1994 (C++ used to be my friend…) Agile Coach since 2009 fernando.a.cuenca@gmail.com @fer_cuenca
  • 3. Big Thanks to our Sponsor! http://digitalfactory.scotiabank.com
  • 4. Agenda TDD in the context of Legacy Code Practice Session 1 + Debrief BREAK Practice Session 2 + Debrief
  • 5. So, what is “Legacy Code” anyways?
  • 6. Code that actively prevents you from making changes Code we’re afraid to change Code where the design makes more design decisions than the programmer Code without Unit Tests
  • 7. you could have a “magic button”… Pecha Kucha @ OOP 2015 "Is TDD dead? https://www.youtube.com/watch?v=9NANcPTbDBQ
  • 9. The Legacy Code Dilemma Michael Feathers “Working Effectively with Legacy Code”
  • 11. Your turn now! 2 Practice sessions + Debrief We need to choose a common Programming Language Java C# Javascript Find a partner (we’ll switch for Session 2) Log in to my Cyber-Dojo: http://cyberdojo.ddns.net
  • 12. Welcome to Ugly Trivia! What does the code do? What are the different RESPONSIBILITIES? How “good” or “bad” is this code? Why? How much “Technical Debt” does it have? Can you identify two distinct kinds of tests? What is the purpose of each?
  • 14. Adding More Characterization Tests What kinds of things are displayed? When? What’s the minimum number of players? What happens when a player rolls? How does the current location change? How are categories selected? How are coins awarded? What’s the order of the players? How big is the board? How is it traversed? What happens when the answer is correct? Incorrect? What are the rules around the “penalty box”?
  • 15. Debrief: What was it like? What are most important insights you gained from the session? What was helpful / not-helpful? What will you do differently in the next session?
  • 16. Let’s fix some defects! Fix typo when answering correctly ("Answer was corrent") Terminate nicely instead of throwing exceptions: when questions run out when rolling before adding players
  • 17. Let’s add some new features! Backlog 1. Display the winner's name when the game ends 2. Display output in multiple languages Guidelines Cover, then modify Can you test-drive a replacement? Are your tests passing all the time? How small are your steps? Can you make them smaller?
  • 18. Large-Scale Refactoring New Features 1. Configurable board size 2. New Category: Politics 3. When questions run out (in any category), the game ends and the player with the most coins wins 4. Different categories pay different amount of coins when answered correctly 5. if 2 people in a row answer incorrectly, the order of players inverts Guidelines Pick a feature to work on Agree on a “good design” for it. Sketch general incremental steps to get there
  • 19. The Mikado Method (https://mikadomethod.wordpress.com)
  • 20. Debrief: What was it like? What are most important insights you gained from this session? What was the overall feeling? How does the result compares to what you initially thought the outcome might be? How/Where could this approach be useful? What will you do differently tomorrow, back in the office?
  • 22. Thank you! And please, complete the feedback forms!!

Notas do Editor

  1. We tend to associate two ideas with “Legacy Code”: old, and messy.
  2. Cyber-dojo start-point: Ugly Trivia / With Tests Ask people to review the code in pairs Distribute responsibilities page (if people need guidance)
  3. Distribute Characterization test list (if people are lost)
  4. Focus is to practice “Cover, then modify” Distribute refactoring diagrams == BREAK ==