SlideShare a Scribd company logo
agile software development & services
TDD & Refactoring
www.10pines.com
Hernán Wilkinson
Twitter: @HernanWilkinson
www.10pines.com
Classes: university.10pines.com
Software
Computable Model of a Problem
Domain
How do you build a Model?
As a car? As a house?
(is build the right word?)
Growing a Model is a “learning
process”
“Constructivism”
“Constructivism” in our field
https://worrydream.com - https://vimeo.com/36579366
▶ Iterative
▶ Incremental
▶ Immediate Feedback
How
What’s TDD?
Is it this?
What no How!
▶ A learning technique
– Iterative
– Incremental
– With Immediate Feedback
▶ Side effects
– Remembers all we learned
– Tells us as soon we make a mistake
What TDD is
▶ It is not testing only
▶ It is not “unit testing” only
– Unit tests are one type of test you can
write when doing TDD
What TDD is not
▶ When building/learning
▶ When not:
– Configuring framework (ex. Hibernate)
– Building visual part of UI
When to and When not to?
How to do TDD?
1) Write a test
- It has to be the simplest one
- Must fail the firt time it is run
1) Write a test
- It has to be the simplest one
- Must fail the firt time it is run
2) Run all tests
- Implement the simples solution that will
make the test/s pass
- GOTO 2 until all test pass
How to do TDD?
1) Write a test
- It has to be the simplest one
- Must fail the firt time it is run
2) Run all tests
- Implement the simples solution that will
make the test/s pass
- GOTO 2 until all test pass
3) Reflect – Can we have a better impl./design?
- Yes -> Refactor. GOTO 2
- No -> GOTO 1
How to do TDD?
1) Write a test
- It has to be the simplest one
- Must fail the firt time it is run
2) Run all tests
- Implement the simples solution that will
make the test/s pass
- GOTO 2 until all test pass
3) Reflect – Can we have a better impl./design?
- Yes -> Refactor. GOTO 2
- No -> GOTO 1
How to do TDD?
1) Write a test
- It has to be the simplest one
- Must fail the firt time it is run
2) Run all tests
- Implement the simples solution that will
make the test/s pass
- GOTO 2 until all test pass
3) Reflect – Can we have a better impl./design?
- Yes -> Refactor. GOTO 2
- No -> GOTO 1
How to do TDD?
1) Write a test
- It has to be the simplest one
- Must fail the firt time it is run
2) Run all tests
- Implement the simples solution that will
make the test/s pass
- GOTO 2 until all test pass
3) Reflect – Can we have a better impl./design?
- Yes -> Refactor. GOTO 2
- No -> GOTO 1
How to do TDD?
1) Write a test
- It has to be the simplest one
- Must fail the firt time it is run
2) Run all tests
- Implement the simples solution that will
make the test/s pass
- GOTO 2 until all test pass
3) Reflect – Can we have a better impl./design?
- Yes -> Refactor. GOTO 2
- No -> GOTO 1
How to do TDD?
Test structure
Setup
Exercise
Assert
Creates the test’s context
Exercises the functionality that is being
tested. Defines WHAT is being tested
Verifies that happened what it was
expected to happend or fails otherwise
Example
▶ Model a Calendar where days can be mark as holidays.
Given a date it should be able to know if it is a holiday or
not
▶ Holidays can be defined using:
– A day of week, ex. Sunday
– A day of month, ex. December 25th
– A specific date, ex. 4/20/2012
Conclusion - Design
It is difficult to name things
 It is because we do not know enough knowledge!
 Do not spend to much time at the beginning
 Use “Meaningless names” instead of “Bad Names” until
you get enough knowledge
Conclusion - Design
It is a continuos learning process
 With time we gained more knowledge about the problem
 We could use better names
 We refactor the code and improve the design
Conclusion - Design
 Implement only what you are testing
 Avoid “Analysis Paralysis”
Conclusion - Technique
Write the assertions first
Assert negative cases, not only positive
ones
Write one test per functional case (it
does not implies one assertion!)
It is a bad smell when test does not
fails on first run
Conclusion - Impact
TDD allow us to have something running
very fast
It’s woking!  Strong psychological effect
Conclusion - Impact
We got a fail inmdiatly after making a
mistake!
It give us confidence on our code
New requirement!
 Weekday and MonthDay holidays can be
defined in an interval:
From 2/8/2002 to 1/31/2018, April 3rd is
holiday
From 1/1/1990 al 12/31/1999 Mondays are
holiday
How do we solve it?
Should we continue with the same
design idea?
Let’s do it!
Conclusion - Design
 The code speaks to us!
The previous solution did not scale
We made it coping and pasting
Conclusion - Design
 The new solution implies a big “conceptual
jump”
Not everybody knows how to do it
That is what we teach in our classes 
Conclusion - Design
 TDD does not implies good design
 Good design is made by good designers!
Conclusion - Impact
 We implemented a new requirement
without loosing quality
 We made a big refactoring!
… and we were not afraid of doing it
… and we could be sure we did not
break anything
Conclusion - Impact
 TDD give us COURAGE to make changes
 TDD help us to avoid the “legacy system”
And remember…
agile software development & services
Thanks!
info@10pines.com
www.10Pines.com
University.10pines.com
twitter: @10Pines
Twitter: @hernanwilkinson
Argentina
Tel.: +54 (11) 6091-3125
Av. Alem 896, 6to
(1001) Buenos Aires

More Related Content

What's hot

Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit Testing
Eyal Kenig
 
Things senior developers should know
Things senior developers should knowThings senior developers should know
Things senior developers should know
Hanokh Aloni
 
Good coding-style, a talk made in 2008 to encourage changes in MySQL coding s...
Good coding-style, a talk made in 2008 to encourage changes in MySQL coding s...Good coding-style, a talk made in 2008 to encourage changes in MySQL coding s...
Good coding-style, a talk made in 2008 to encourage changes in MySQL coding s...Kostja Osipov
 
The ten commandments of TDD
The ten commandments of TDDThe ten commandments of TDD
The ten commandments of TDDHernan Wilkinson
 
TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018
Paulo Clavijo
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
Kathryne Dunlap
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
Trisha Gee
 
Test driven development - why you should test first?
Test driven development - why you should test first?Test driven development - why you should test first?
Test driven development - why you should test first?
Abimbola Idowu
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
Trisha Gee
 
NEDCamp Translation 5 Tips
NEDCamp Translation 5 TipsNEDCamp Translation 5 Tips
NEDCamp Translation 5 Tips
Oomph, Inc.
 
Make a better with clean code
Make a better with clean codeMake a better with clean code
Make a better with clean code
Keattiwut Kosittaruk
 
I'm a TDD cheat and I'm not afraid to admit it
I'm a TDD cheat and I'm not afraid to admit itI'm a TDD cheat and I'm not afraid to admit it
I'm a TDD cheat and I'm not afraid to admit it
Daniel Irvine
 
top developer mistakes
top developer mistakes top developer mistakes
top developer mistakes
Hanokh Aloni
 
Day1 - TDD (Lecture SS 2015)
Day1 - TDD (Lecture SS 2015)Day1 - TDD (Lecture SS 2015)
Day1 - TDD (Lecture SS 2015)
wolframkriesing
 
Training methdology testers to developers
Training methdology   testers to developersTraining methdology   testers to developers
Training methdology testers to developers
Gurumurthy Ramamurthy
 
Lessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorialLessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorial
Alan Richardson
 
Los diez mandamientos de TDD
Los diez mandamientos de TDDLos diez mandamientos de TDD
Los diez mandamientos de TDD
Hernan Wilkinson
 
Definition of ready vs. Refinement Process: PHP CE Conference
Definition of ready vs. Refinement Process: PHP CE ConferenceDefinition of ready vs. Refinement Process: PHP CE Conference
Definition of ready vs. Refinement Process: PHP CE Conference
Agata Sobek-Kreft
 
Requirements are Boring, and other Myths (EclipseCon 2013 Lightning talk)
Requirements are Boring, and other Myths (EclipseCon 2013 Lightning talk)Requirements are Boring, and other Myths (EclipseCon 2013 Lightning talk)
Requirements are Boring, and other Myths (EclipseCon 2013 Lightning talk)jastram
 
Webdev and programming
Webdev and programming  Webdev and programming
Webdev and programming
George Ingram
 

What's hot (20)

Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit Testing
 
Things senior developers should know
Things senior developers should knowThings senior developers should know
Things senior developers should know
 
Good coding-style, a talk made in 2008 to encourage changes in MySQL coding s...
Good coding-style, a talk made in 2008 to encourage changes in MySQL coding s...Good coding-style, a talk made in 2008 to encourage changes in MySQL coding s...
Good coding-style, a talk made in 2008 to encourage changes in MySQL coding s...
 
The ten commandments of TDD
The ten commandments of TDDThe ten commandments of TDD
The ten commandments of TDD
 
TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018TDD and Simple Design Workshop - Session 1 - November 2018
TDD and Simple Design Workshop - Session 1 - November 2018
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
Test driven development - why you should test first?
Test driven development - why you should test first?Test driven development - why you should test first?
Test driven development - why you should test first?
 
Level Up Your Automated Tests
Level Up Your Automated TestsLevel Up Your Automated Tests
Level Up Your Automated Tests
 
NEDCamp Translation 5 Tips
NEDCamp Translation 5 TipsNEDCamp Translation 5 Tips
NEDCamp Translation 5 Tips
 
Make a better with clean code
Make a better with clean codeMake a better with clean code
Make a better with clean code
 
I'm a TDD cheat and I'm not afraid to admit it
I'm a TDD cheat and I'm not afraid to admit itI'm a TDD cheat and I'm not afraid to admit it
I'm a TDD cheat and I'm not afraid to admit it
 
top developer mistakes
top developer mistakes top developer mistakes
top developer mistakes
 
Day1 - TDD (Lecture SS 2015)
Day1 - TDD (Lecture SS 2015)Day1 - TDD (Lecture SS 2015)
Day1 - TDD (Lecture SS 2015)
 
Training methdology testers to developers
Training methdology   testers to developersTraining methdology   testers to developers
Training methdology testers to developers
 
Lessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorialLessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorial
 
Los diez mandamientos de TDD
Los diez mandamientos de TDDLos diez mandamientos de TDD
Los diez mandamientos de TDD
 
Definition of ready vs. Refinement Process: PHP CE Conference
Definition of ready vs. Refinement Process: PHP CE ConferenceDefinition of ready vs. Refinement Process: PHP CE Conference
Definition of ready vs. Refinement Process: PHP CE Conference
 
Requirements are Boring, and other Myths (EclipseCon 2013 Lightning talk)
Requirements are Boring, and other Myths (EclipseCon 2013 Lightning talk)Requirements are Boring, and other Myths (EclipseCon 2013 Lightning talk)
Requirements are Boring, and other Myths (EclipseCon 2013 Lightning talk)
 
Webdev and programming
Webdev and programming  Webdev and programming
Webdev and programming
 

Similar to TDD & Refactoring

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
Paulo Clavijo
 
Agile Practices
Agile PracticesAgile Practices
Agile Practices
Thatchaphol Saranurak
 
How Do We Teach TDD Keith Ray
How Do We Teach TDD Keith RayHow Do We Teach TDD Keith Ray
How Do We Teach TDD Keith Ray
C. Keith Ray
 
What is Agile Scrum
What is Agile ScrumWhat is Agile Scrum
What is Agile Scrum
vincentmedicanimal
 
TDD in Agile
TDD in AgileTDD in Agile
TDD in Agile
Atish Narlawar
 
An Introduction To Agile Development
An Introduction To Agile DevelopmentAn Introduction To Agile Development
An Introduction To Agile Developmentelliando dias
 
Tdd
TddTdd
The problem with tdd
The problem with tddThe problem with tdd
The problem with tddDror Helper
 
Design Sprints
Design SprintsDesign Sprints
Design Sprints
Kate Hanson
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy
Vijay Kumbhar
 
Coding Dojo Firenze - vol1
Coding Dojo Firenze - vol1 Coding Dojo Firenze - vol1
Coding Dojo Firenze - vol1
Massimo Iacolare
 
Introduction to TDD
Introduction to TDDIntroduction to TDD
Introduction to TDD
Ahmed Misbah
 
TDD - Unit testing done right and programmer happiness
TDD - Unit testing done right and programmer happinessTDD - Unit testing done right and programmer happiness
TDD - Unit testing done right and programmer happiness
Erez Cohen
 
Getting Things Done - internal implementation plan
Getting Things Done - internal implementation planGetting Things Done - internal implementation plan
Getting Things Done - internal implementation plan
HerbJones
 
Kobi_H_2018_JustEnoughTesting_02_TestIL_handout
Kobi_H_2018_JustEnoughTesting_02_TestIL_handoutKobi_H_2018_JustEnoughTesting_02_TestIL_handout
Kobi_H_2018_JustEnoughTesting_02_TestIL_handout
Kobi Halperin
 
Tdd - Test Driven Development
Tdd - Test Driven DevelopmentTdd - Test Driven Development
Tdd - Test Driven Development
David Paluy
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
Pablo Villar
 
Just test it - discovering new products and reducing risk through rapid proto...
Just test it - discovering new products and reducing risk through rapid proto...Just test it - discovering new products and reducing risk through rapid proto...
Just test it - discovering new products and reducing risk through rapid proto...
Philip Pantelides
 
Building software vs programming
Building software vs programmingBuilding software vs programming
Building software vs programming
Mauricio Voto
 
Testaus 2014 -seminaari: Arto Kiiskinen, Mirasys Oy. Case Mirasys: Toiminnoil...
Testaus 2014 -seminaari: Arto Kiiskinen, Mirasys Oy. Case Mirasys: Toiminnoil...Testaus 2014 -seminaari: Arto Kiiskinen, Mirasys Oy. Case Mirasys: Toiminnoil...
Testaus 2014 -seminaari: Arto Kiiskinen, Mirasys Oy. Case Mirasys: Toiminnoil...
Tieturi Oy
 

Similar to TDD & Refactoring (20)

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
 
Agile Practices
Agile PracticesAgile Practices
Agile Practices
 
How Do We Teach TDD Keith Ray
How Do We Teach TDD Keith RayHow Do We Teach TDD Keith Ray
How Do We Teach TDD Keith Ray
 
What is Agile Scrum
What is Agile ScrumWhat is Agile Scrum
What is Agile Scrum
 
TDD in Agile
TDD in AgileTDD in Agile
TDD in Agile
 
An Introduction To Agile Development
An Introduction To Agile DevelopmentAn Introduction To Agile Development
An Introduction To Agile Development
 
Tdd
TddTdd
Tdd
 
The problem with tdd
The problem with tddThe problem with tdd
The problem with tdd
 
Design Sprints
Design SprintsDesign Sprints
Design Sprints
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy
 
Coding Dojo Firenze - vol1
Coding Dojo Firenze - vol1 Coding Dojo Firenze - vol1
Coding Dojo Firenze - vol1
 
Introduction to TDD
Introduction to TDDIntroduction to TDD
Introduction to TDD
 
TDD - Unit testing done right and programmer happiness
TDD - Unit testing done right and programmer happinessTDD - Unit testing done right and programmer happiness
TDD - Unit testing done right and programmer happiness
 
Getting Things Done - internal implementation plan
Getting Things Done - internal implementation planGetting Things Done - internal implementation plan
Getting Things Done - internal implementation plan
 
Kobi_H_2018_JustEnoughTesting_02_TestIL_handout
Kobi_H_2018_JustEnoughTesting_02_TestIL_handoutKobi_H_2018_JustEnoughTesting_02_TestIL_handout
Kobi_H_2018_JustEnoughTesting_02_TestIL_handout
 
Tdd - Test Driven Development
Tdd - Test Driven DevelopmentTdd - Test Driven Development
Tdd - Test Driven Development
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
 
Just test it - discovering new products and reducing risk through rapid proto...
Just test it - discovering new products and reducing risk through rapid proto...Just test it - discovering new products and reducing risk through rapid proto...
Just test it - discovering new products and reducing risk through rapid proto...
 
Building software vs programming
Building software vs programmingBuilding software vs programming
Building software vs programming
 
Testaus 2014 -seminaari: Arto Kiiskinen, Mirasys Oy. Case Mirasys: Toiminnoil...
Testaus 2014 -seminaari: Arto Kiiskinen, Mirasys Oy. Case Mirasys: Toiminnoil...Testaus 2014 -seminaari: Arto Kiiskinen, Mirasys Oy. Case Mirasys: Toiminnoil...
Testaus 2014 -seminaari: Arto Kiiskinen, Mirasys Oy. Case Mirasys: Toiminnoil...
 

More from Hernan Wilkinson

Hacia una síntesis de diseño a partir de entender qué es modelar con software
Hacia una síntesis de diseño a partir de entender qué es modelar con softwareHacia una síntesis de diseño a partir de entender qué es modelar con software
Hacia una síntesis de diseño a partir de entender qué es modelar con software
Hernan Wilkinson
 
Live Typing - California Smalltalkers
Live Typing - California SmalltalkersLive Typing - California Smalltalkers
Live Typing - California Smalltalkers
Hernan Wilkinson
 
Buenos Aires vs. (London vs. Chicago) Agiles 2020
Buenos Aires vs. (London vs. Chicago) Agiles 2020Buenos Aires vs. (London vs. Chicago) Agiles 2020
Buenos Aires vs. (London vs. Chicago) Agiles 2020
Hernan Wilkinson
 
LiveTyping - Anotación automática de tipos para lenguajes dinámicos
LiveTyping - Anotación automática de tipos para lenguajes dinámicosLiveTyping - Anotación automática de tipos para lenguajes dinámicos
LiveTyping - Anotación automática de tipos para lenguajes dinámicos
Hernan Wilkinson
 
LiveTyping: Update and What is next
LiveTyping: Update and What is nextLiveTyping: Update and What is next
LiveTyping: Update and What is next
Hernan Wilkinson
 
Cuis smalltalk past present and future
Cuis smalltalk past present and futureCuis smalltalk past present and future
Cuis smalltalk past present and future
Hernan Wilkinson
 
Live Typing - Automatic Type Annotation that improves the Programming eXperie...
Live Typing- Automatic Type Annotation that improves the Programming eXperie...Live Typing- Automatic Type Annotation that improves the Programming eXperie...
Live Typing - Automatic Type Annotation that improves the Programming eXperie...
Hernan Wilkinson
 
El Desarrollo de Software como debería Ser - PyConAr 2018
El Desarrollo de Software como debería Ser - PyConAr 2018El Desarrollo de Software como debería Ser - PyConAr 2018
El Desarrollo de Software como debería Ser - PyConAr 2018
Hernan Wilkinson
 
Lessons Learned Implementing Refactorings
Lessons Learned Implementing RefactoringsLessons Learned Implementing Refactorings
Lessons Learned Implementing Refactorings
Hernan Wilkinson
 
Dynamic Type Information
Dynamic Type InformationDynamic Type Information
Dynamic Type Information
Hernan Wilkinson
 
El Desarrollo de Software como debería Ser - Nerdear.la 2018
El Desarrollo de Software como debería Ser - Nerdear.la 2018El Desarrollo de Software como debería Ser - Nerdear.la 2018
El Desarrollo de Software como debería Ser - Nerdear.la 2018
Hernan Wilkinson
 
El Desarrollo de Software como debería Ser
El Desarrollo de Software como debería SerEl Desarrollo de Software como debería Ser
El Desarrollo de Software como debería Ser
Hernan Wilkinson
 
CuisUniversity
CuisUniversityCuisUniversity
CuisUniversity
Hernan Wilkinson
 
Oop is not Dead
Oop is not DeadOop is not Dead
Oop is not Dead
Hernan Wilkinson
 
Augmenting Smalltalk Syntax
Augmenting Smalltalk SyntaxAugmenting Smalltalk Syntax
Augmenting Smalltalk Syntax
Hernan Wilkinson
 
Growing an open participative horizontal and based on trust company
Growing an open participative horizontal and based on trust companyGrowing an open participative horizontal and based on trust company
Growing an open participative horizontal and based on trust company
Hernan Wilkinson
 
Como escribir buenos tests al hacer TDD
Como escribir buenos tests al hacer TDDComo escribir buenos tests al hacer TDD
Como escribir buenos tests al hacer TDD
Hernan Wilkinson
 
Desarrollando sistemas con metodologías y técnicas agiles
Desarrollando sistemas con metodologías y técnicas agilesDesarrollando sistemas con metodologías y técnicas agiles
Desarrollando sistemas con metodologías y técnicas agiles
Hernan Wilkinson
 
Técnicas y herramientas para que la computadora haga más y el programador m...
Técnicas y herramientas para que la computadora haga más y el programador m...Técnicas y herramientas para que la computadora haga más y el programador m...
Técnicas y herramientas para que la computadora haga más y el programador m...
Hernan Wilkinson
 
Obejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCMObejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCM
Hernan Wilkinson
 

More from Hernan Wilkinson (20)

Hacia una síntesis de diseño a partir de entender qué es modelar con software
Hacia una síntesis de diseño a partir de entender qué es modelar con softwareHacia una síntesis de diseño a partir de entender qué es modelar con software
Hacia una síntesis de diseño a partir de entender qué es modelar con software
 
Live Typing - California Smalltalkers
Live Typing - California SmalltalkersLive Typing - California Smalltalkers
Live Typing - California Smalltalkers
 
Buenos Aires vs. (London vs. Chicago) Agiles 2020
Buenos Aires vs. (London vs. Chicago) Agiles 2020Buenos Aires vs. (London vs. Chicago) Agiles 2020
Buenos Aires vs. (London vs. Chicago) Agiles 2020
 
LiveTyping - Anotación automática de tipos para lenguajes dinámicos
LiveTyping - Anotación automática de tipos para lenguajes dinámicosLiveTyping - Anotación automática de tipos para lenguajes dinámicos
LiveTyping - Anotación automática de tipos para lenguajes dinámicos
 
LiveTyping: Update and What is next
LiveTyping: Update and What is nextLiveTyping: Update and What is next
LiveTyping: Update and What is next
 
Cuis smalltalk past present and future
Cuis smalltalk past present and futureCuis smalltalk past present and future
Cuis smalltalk past present and future
 
Live Typing - Automatic Type Annotation that improves the Programming eXperie...
Live Typing- Automatic Type Annotation that improves the Programming eXperie...Live Typing- Automatic Type Annotation that improves the Programming eXperie...
Live Typing - Automatic Type Annotation that improves the Programming eXperie...
 
El Desarrollo de Software como debería Ser - PyConAr 2018
El Desarrollo de Software como debería Ser - PyConAr 2018El Desarrollo de Software como debería Ser - PyConAr 2018
El Desarrollo de Software como debería Ser - PyConAr 2018
 
Lessons Learned Implementing Refactorings
Lessons Learned Implementing RefactoringsLessons Learned Implementing Refactorings
Lessons Learned Implementing Refactorings
 
Dynamic Type Information
Dynamic Type InformationDynamic Type Information
Dynamic Type Information
 
El Desarrollo de Software como debería Ser - Nerdear.la 2018
El Desarrollo de Software como debería Ser - Nerdear.la 2018El Desarrollo de Software como debería Ser - Nerdear.la 2018
El Desarrollo de Software como debería Ser - Nerdear.la 2018
 
El Desarrollo de Software como debería Ser
El Desarrollo de Software como debería SerEl Desarrollo de Software como debería Ser
El Desarrollo de Software como debería Ser
 
CuisUniversity
CuisUniversityCuisUniversity
CuisUniversity
 
Oop is not Dead
Oop is not DeadOop is not Dead
Oop is not Dead
 
Augmenting Smalltalk Syntax
Augmenting Smalltalk SyntaxAugmenting Smalltalk Syntax
Augmenting Smalltalk Syntax
 
Growing an open participative horizontal and based on trust company
Growing an open participative horizontal and based on trust companyGrowing an open participative horizontal and based on trust company
Growing an open participative horizontal and based on trust company
 
Como escribir buenos tests al hacer TDD
Como escribir buenos tests al hacer TDDComo escribir buenos tests al hacer TDD
Como escribir buenos tests al hacer TDD
 
Desarrollando sistemas con metodologías y técnicas agiles
Desarrollando sistemas con metodologías y técnicas agilesDesarrollando sistemas con metodologías y técnicas agiles
Desarrollando sistemas con metodologías y técnicas agiles
 
Técnicas y herramientas para que la computadora haga más y el programador m...
Técnicas y herramientas para que la computadora haga más y el programador m...Técnicas y herramientas para que la computadora haga más y el programador m...
Técnicas y herramientas para que la computadora haga más y el programador m...
 
Obejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCMObejct Oriented SCM - OOSCM
Obejct Oriented SCM - OOSCM
 

Recently uploaded

APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 

Recently uploaded (20)

APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 

TDD & Refactoring

  • 1. agile software development & services TDD & Refactoring www.10pines.com Hernán Wilkinson Twitter: @HernanWilkinson www.10pines.com Classes: university.10pines.com
  • 3. Computable Model of a Problem Domain
  • 4. How do you build a Model? As a car? As a house? (is build the right word?)
  • 5. Growing a Model is a “learning process”
  • 7. “Constructivism” in our field https://worrydream.com - https://vimeo.com/36579366
  • 8. ▶ Iterative ▶ Incremental ▶ Immediate Feedback How
  • 12. ▶ A learning technique – Iterative – Incremental – With Immediate Feedback ▶ Side effects – Remembers all we learned – Tells us as soon we make a mistake What TDD is
  • 13. ▶ It is not testing only ▶ It is not “unit testing” only – Unit tests are one type of test you can write when doing TDD What TDD is not
  • 14. ▶ When building/learning ▶ When not: – Configuring framework (ex. Hibernate) – Building visual part of UI When to and When not to?
  • 15. How to do TDD? 1) Write a test - It has to be the simplest one - Must fail the firt time it is run
  • 16. 1) Write a test - It has to be the simplest one - Must fail the firt time it is run 2) Run all tests - Implement the simples solution that will make the test/s pass - GOTO 2 until all test pass How to do TDD?
  • 17. 1) Write a test - It has to be the simplest one - Must fail the firt time it is run 2) Run all tests - Implement the simples solution that will make the test/s pass - GOTO 2 until all test pass 3) Reflect – Can we have a better impl./design? - Yes -> Refactor. GOTO 2 - No -> GOTO 1 How to do TDD?
  • 18. 1) Write a test - It has to be the simplest one - Must fail the firt time it is run 2) Run all tests - Implement the simples solution that will make the test/s pass - GOTO 2 until all test pass 3) Reflect – Can we have a better impl./design? - Yes -> Refactor. GOTO 2 - No -> GOTO 1 How to do TDD?
  • 19. 1) Write a test - It has to be the simplest one - Must fail the firt time it is run 2) Run all tests - Implement the simples solution that will make the test/s pass - GOTO 2 until all test pass 3) Reflect – Can we have a better impl./design? - Yes -> Refactor. GOTO 2 - No -> GOTO 1 How to do TDD?
  • 20. 1) Write a test - It has to be the simplest one - Must fail the firt time it is run 2) Run all tests - Implement the simples solution that will make the test/s pass - GOTO 2 until all test pass 3) Reflect – Can we have a better impl./design? - Yes -> Refactor. GOTO 2 - No -> GOTO 1 How to do TDD?
  • 21. 1) Write a test - It has to be the simplest one - Must fail the firt time it is run 2) Run all tests - Implement the simples solution that will make the test/s pass - GOTO 2 until all test pass 3) Reflect – Can we have a better impl./design? - Yes -> Refactor. GOTO 2 - No -> GOTO 1 How to do TDD?
  • 22. Test structure Setup Exercise Assert Creates the test’s context Exercises the functionality that is being tested. Defines WHAT is being tested Verifies that happened what it was expected to happend or fails otherwise
  • 23. Example ▶ Model a Calendar where days can be mark as holidays. Given a date it should be able to know if it is a holiday or not ▶ Holidays can be defined using: – A day of week, ex. Sunday – A day of month, ex. December 25th – A specific date, ex. 4/20/2012
  • 24. Conclusion - Design It is difficult to name things  It is because we do not know enough knowledge!  Do not spend to much time at the beginning  Use “Meaningless names” instead of “Bad Names” until you get enough knowledge
  • 25. Conclusion - Design It is a continuos learning process  With time we gained more knowledge about the problem  We could use better names  We refactor the code and improve the design
  • 26. Conclusion - Design  Implement only what you are testing  Avoid “Analysis Paralysis”
  • 27. Conclusion - Technique Write the assertions first Assert negative cases, not only positive ones Write one test per functional case (it does not implies one assertion!) It is a bad smell when test does not fails on first run
  • 28. Conclusion - Impact TDD allow us to have something running very fast It’s woking!  Strong psychological effect
  • 29. Conclusion - Impact We got a fail inmdiatly after making a mistake! It give us confidence on our code
  • 30. New requirement!  Weekday and MonthDay holidays can be defined in an interval: From 2/8/2002 to 1/31/2018, April 3rd is holiday From 1/1/1990 al 12/31/1999 Mondays are holiday
  • 31. How do we solve it? Should we continue with the same design idea?
  • 32.
  • 33.
  • 35. Conclusion - Design  The code speaks to us! The previous solution did not scale We made it coping and pasting
  • 36. Conclusion - Design  The new solution implies a big “conceptual jump” Not everybody knows how to do it That is what we teach in our classes 
  • 37. Conclusion - Design  TDD does not implies good design  Good design is made by good designers!
  • 38. Conclusion - Impact  We implemented a new requirement without loosing quality  We made a big refactoring! … and we were not afraid of doing it … and we could be sure we did not break anything
  • 39. Conclusion - Impact  TDD give us COURAGE to make changes  TDD help us to avoid the “legacy system”
  • 41. agile software development & services Thanks! info@10pines.com www.10Pines.com University.10pines.com twitter: @10Pines Twitter: @hernanwilkinson Argentina Tel.: +54 (11) 6091-3125 Av. Alem 896, 6to (1001) Buenos Aires