SlideShare a Scribd company logo
1 of 34
Download to read offline
TDD, the way to better software by Ursu Dan
Session 2/6 15:00 - 16:00
#Codeway
Dan Ursu, iOS Developer YOPESO
The Problem:
Have you ever told said the following things
“After the next release
let’s put aside 3 days for
refactoring”
Manager’s thoughts:
“Again with these
arguments about clean
code?”
“This task requires me to
change the architecture
so it takes a long time”
Manager’s thoughts: “ But it’s
a simple button, why does a
simple button cause an
architectural change?”
“I fixed one bug and 10
others popped up in
another place”
Manager’s thoughts: “I am
starting to think
you are unprofessional”
“I’m not sure how the code
works because the colleague
who wrote it is on a vacation”
Manager’s thoughts: “Really
unprofessional”
“I don’t clean this piece
of ugly code because i’m
afraid it will break things”
Manager’s thoughts:
“You sound highly
incompetent”
“I’ll finish the task and
clean the code
afterwards”
Manager’s thoughts: 

“Yet you always seem
to set aside time for refactoring”
You should never ask time for refactoring. You
should refactor every time you see bad code.
You never ask time to write good software, the
same way Cooks don’t ask time to cook good
food.
So what is TDD?
Test driven development is
a discipline that eliminates
fear of cleaning code.
Demo
Eliminate fear? What an interesting and fascinating idea.
The 3 laws of TDD
1. You are not allowed to write any production code
unless it is to make a failing unit test pass.
2. You are not allowed to write any more production
code than is sufficient to pass the one failing unit
test.
3. You are not allowed to write any more of a unit
test than is sufficient to fail;
2 You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.2
3 You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
1. Write a failing unit test
2. Make the test pass by implementing it
3. Refactor
Repeat until software is done
TDD laws lock you into a cycle
Credits
TDD is popularized by Uncle Bob (real name Robert C. Martin)
TDD in live demo
I like those unit tests. Can i get a
pair?
So how do you get to TRUST your tests?
Follow the 3 laws of TDD. Follow them always. If every line of
code was written to make a failing unit test pass, you will trust
your tests.
Before making up your mind on to TDD
1. What would your life be if all your unit test would pass every
minute or so?
2. Low level documentation. TDD generates a low level
documentation so formal that it executes. It never gets old.
3. Since tests are written first they have a massive impact
on your code. Writing tests first makes your code testable.
And another word for testable is decoupled.
You get a better design simply by writing your tests first.
So you get:


1. Reduced debug time
2. Complete and reliable documentation
3. Improved design
How much would you pay now for a suite of unit tests?
Eliminate fear of
changing and cleaning
code.
Consider this:

Perfectly designed systems with no tests
vs
Bad design but fully covered with tests that
you trust
Objections to TDD
Q: My manager doesn’t allow me to use TDD.
Objections to TDD
Q: Who tests the tests?
Objections to TDD
Q: Why not write tests at last?
Objections to TDD
Q: I already have a project which was not developed using
TDD, so i won’t write tests because it’s too late.
Objections to TDD
Q: I’m working on an application with a cool UI and nothing
else. You don't want me to write tests for the UI do you?
Objections to TDD
Q: Testing individual methods or classes is hard. Why not test
the code through the User Interface.
A: Because by the time you run your UI test, you would have
written so much bad code, that a failing test can only confirm
that human beings make mistakes. Testing individual methods
provides feedback much faster, when its not too late.
–Robert C. Martin
“It is irresponsible to ship a single line of code
without executing it in a test ”
Conclusions
1. Code rots because we are afraid to clean it.
2. To keep a system clean we need to eliminate the fear
3. The only way to do that is by having a good suite of tests
4. In order to get the tests practice the 3 laws of TDD
5. TDD ties deeply into professionalism
More Information
Original TDD presentation
https://cleancoders.com/episode/clean-code-episode-6-p1/show
17:00 - 18:00 Software architecture. Letting go of MVC by Ursu Dan

More Related Content

What's hot

TDD python ne-april-2014
TDD python ne-april-2014TDD python ne-april-2014
TDD python ne-april-2014Alex Kavanagh
 
Working effectively with legacy codes
Working effectively with legacy codesWorking effectively with legacy codes
Working effectively with legacy codesAli Shariat
 
Alexandru Bolboaca - Unit Testing from the Trenches
Alexandru Bolboaca - Unit Testing from the TrenchesAlexandru Bolboaca - Unit Testing from the Trenches
Alexandru Bolboaca - Unit Testing from the TrenchesMozaic Works
 
Why and how to keep your code quality
Why and how to keep your code quality Why and how to keep your code quality
Why and how to keep your code quality Krešimir Antolić
 
Agile Network India | Challenges in executing Agile Projects to deliver value...
Agile Network India | Challenges in executing Agile Projects to deliver value...Agile Network India | Challenges in executing Agile Projects to deliver value...
Agile Network India | Challenges in executing Agile Projects to deliver value...AgileNetwork
 
"I’ve heard you know infrastructure"
"I’ve heard you know infrastructure""I’ve heard you know infrastructure"
"I’ve heard you know infrastructure"Anton Babenko
 
Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do itMartin Sykora
 
Introduction to test programming
Introduction to test programmingIntroduction to test programming
Introduction to test programmingopenfinanceDev
 
Outside-in Testing in Vue with Cypress
Outside-in Testing in Vue with CypressOutside-in Testing in Vue with Cypress
Outside-in Testing in Vue with CypressJosh Justice
 
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 -...Andrea Francia
 
Software Debugging for High-altitude Balloons
Software Debugging for High-altitude BalloonsSoftware Debugging for High-altitude Balloons
Software Debugging for High-altitude Balloonsjgrahamc
 
Unit testing solid fundamentals
Unit testing solid fundamentalsUnit testing solid fundamentals
Unit testing solid fundamentalsMilan Vukoje
 

What's hot (20)

TDD python ne-april-2014
TDD python ne-april-2014TDD python ne-april-2014
TDD python ne-april-2014
 
Presentation_TDD
Presentation_TDDPresentation_TDD
Presentation_TDD
 
Onlinequiz games
Onlinequiz gamesOnlinequiz games
Onlinequiz games
 
Working effectively with legacy codes
Working effectively with legacy codesWorking effectively with legacy codes
Working effectively with legacy codes
 
Alexandru Bolboaca - Unit Testing from the Trenches
Alexandru Bolboaca - Unit Testing from the TrenchesAlexandru Bolboaca - Unit Testing from the Trenches
Alexandru Bolboaca - Unit Testing from the Trenches
 
Tdd
TddTdd
Tdd
 
Delhi first draft_2
Delhi first draft_2Delhi first draft_2
Delhi first draft_2
 
Why and how to keep your code quality
Why and how to keep your code quality Why and how to keep your code quality
Why and how to keep your code quality
 
Best pratice
Best praticeBest pratice
Best pratice
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Code review at large scale
Code review at large scaleCode review at large scale
Code review at large scale
 
Agile Network India | Challenges in executing Agile Projects to deliver value...
Agile Network India | Challenges in executing Agile Projects to deliver value...Agile Network India | Challenges in executing Agile Projects to deliver value...
Agile Network India | Challenges in executing Agile Projects to deliver value...
 
"I’ve heard you know infrastructure"
"I’ve heard you know infrastructure""I’ve heard you know infrastructure"
"I’ve heard you know infrastructure"
 
Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do it
 
Introduction to test programming
Introduction to test programmingIntroduction to test programming
Introduction to test programming
 
Outside-in Testing in Vue with Cypress
Outside-in Testing in Vue with CypressOutside-in Testing in Vue with Cypress
Outside-in Testing in Vue with Cypress
 
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 -...
 
2014 pycon-talk
2014 pycon-talk2014 pycon-talk
2014 pycon-talk
 
Software Debugging for High-altitude Balloons
Software Debugging for High-altitude BalloonsSoftware Debugging for High-altitude Balloons
Software Debugging for High-altitude Balloons
 
Unit testing solid fundamentals
Unit testing solid fundamentalsUnit testing solid fundamentals
Unit testing solid fundamentals
 

Viewers also liked

Manual de Etiqueta Sustentável
Manual de Etiqueta SustentávelManual de Etiqueta Sustentável
Manual de Etiqueta SustentávelCOOAMPLA
 
Taller de mediación en el colegio Europa de Montequinto
Taller de mediación en el colegio Europa de MontequintoTaller de mediación en el colegio Europa de Montequinto
Taller de mediación en el colegio Europa de MontequintoCEIP Europa
 
Oracle Service Cloud Benefits for you
Oracle Service Cloud Benefits for youOracle Service Cloud Benefits for you
Oracle Service Cloud Benefits for youVincent van Huizen
 
Keynote capitals india morning note 07 november-12
Keynote capitals india morning note 07 november-12Keynote capitals india morning note 07 november-12
Keynote capitals india morning note 07 november-12Keynote Capitals Ltd.
 
Stermedia Profile und Portfolio
Stermedia Profile und PortfolioStermedia Profile und Portfolio
Stermedia Profile und Portfoliostermedia
 
Content Marketing Strategy Attracts New Business
Content Marketing Strategy Attracts New BusinessContent Marketing Strategy Attracts New Business
Content Marketing Strategy Attracts New BusinessSRIMedia
 
Reunión de socios PMI Madrid Spain Chapter - 29-octubre-2013
Reunión de socios PMI Madrid Spain Chapter - 29-octubre-2013Reunión de socios PMI Madrid Spain Chapter - 29-octubre-2013
Reunión de socios PMI Madrid Spain Chapter - 29-octubre-2013Jesús Vázquez González
 
Plantilla para evaluar recursos digitales asmed
Plantilla para evaluar recursos digitales asmedPlantilla para evaluar recursos digitales asmed
Plantilla para evaluar recursos digitales asmedAsmed Trujillo
 
PresentacióN Smh Red.Es V.1.2
PresentacióN Smh   Red.Es V.1.2PresentacióN Smh   Red.Es V.1.2
PresentacióN Smh Red.Es V.1.2muriel sebas
 
Menú San Valentín 2014 Restaurante Manolín Valladolid
Menú San Valentín 2014 Restaurante Manolín ValladolidMenú San Valentín 2014 Restaurante Manolín Valladolid
Menú San Valentín 2014 Restaurante Manolín ValladolidRestaurante Manolín Valladolid
 
Donation For Anna Hazare Movement in 2010 12
Donation For Anna Hazare Movement in 2010 12Donation For Anna Hazare Movement in 2010 12
Donation For Anna Hazare Movement in 2010 12Akash Agrawal
 
Sig t01-modelos de datos-dominios-representacion
Sig t01-modelos de datos-dominios-representacionSig t01-modelos de datos-dominios-representacion
Sig t01-modelos de datos-dominios-representacionGabriel Parodi
 
"La ciudad de los niños" (ideas)
"La ciudad de los niños" (ideas)"La ciudad de los niños" (ideas)
"La ciudad de los niños" (ideas)Sara Alonso Diez
 
sistema de riego para cultivo
sistema de riego para cultivosistema de riego para cultivo
sistema de riego para cultivobaTakoOscar
 

Viewers also liked (20)

130717666736980000
130717666736980000130717666736980000
130717666736980000
 
Manual de Etiqueta Sustentável
Manual de Etiqueta SustentávelManual de Etiqueta Sustentável
Manual de Etiqueta Sustentável
 
Taller de mediación en el colegio Europa de Montequinto
Taller de mediación en el colegio Europa de MontequintoTaller de mediación en el colegio Europa de Montequinto
Taller de mediación en el colegio Europa de Montequinto
 
Oracle Service Cloud Benefits for you
Oracle Service Cloud Benefits for youOracle Service Cloud Benefits for you
Oracle Service Cloud Benefits for you
 
Bondia Lleida 13042012
Bondia Lleida 13042012Bondia Lleida 13042012
Bondia Lleida 13042012
 
Keynote capitals india morning note 07 november-12
Keynote capitals india morning note 07 november-12Keynote capitals india morning note 07 november-12
Keynote capitals india morning note 07 november-12
 
Stermedia Profile und Portfolio
Stermedia Profile und PortfolioStermedia Profile und Portfolio
Stermedia Profile und Portfolio
 
Content Marketing Strategy Attracts New Business
Content Marketing Strategy Attracts New BusinessContent Marketing Strategy Attracts New Business
Content Marketing Strategy Attracts New Business
 
Reunión de socios PMI Madrid Spain Chapter - 29-octubre-2013
Reunión de socios PMI Madrid Spain Chapter - 29-octubre-2013Reunión de socios PMI Madrid Spain Chapter - 29-octubre-2013
Reunión de socios PMI Madrid Spain Chapter - 29-octubre-2013
 
Plantilla para evaluar recursos digitales asmed
Plantilla para evaluar recursos digitales asmedPlantilla para evaluar recursos digitales asmed
Plantilla para evaluar recursos digitales asmed
 
PresentacióN Smh Red.Es V.1.2
PresentacióN Smh   Red.Es V.1.2PresentacióN Smh   Red.Es V.1.2
PresentacióN Smh Red.Es V.1.2
 
Netiquette
NetiquetteNetiquette
Netiquette
 
Menú San Valentín 2014 Restaurante Manolín Valladolid
Menú San Valentín 2014 Restaurante Manolín ValladolidMenú San Valentín 2014 Restaurante Manolín Valladolid
Menú San Valentín 2014 Restaurante Manolín Valladolid
 
Andele del siglo xxi mayo-junio10
Andele del siglo xxi   mayo-junio10Andele del siglo xxi   mayo-junio10
Andele del siglo xxi mayo-junio10
 
Donation For Anna Hazare Movement in 2010 12
Donation For Anna Hazare Movement in 2010 12Donation For Anna Hazare Movement in 2010 12
Donation For Anna Hazare Movement in 2010 12
 
Perfil Biográfico: Ángel Páez
Perfil Biográfico: Ángel PáezPerfil Biográfico: Ángel Páez
Perfil Biográfico: Ángel Páez
 
Sig t01-modelos de datos-dominios-representacion
Sig t01-modelos de datos-dominios-representacionSig t01-modelos de datos-dominios-representacion
Sig t01-modelos de datos-dominios-representacion
 
"La ciudad de los niños" (ideas)
"La ciudad de los niños" (ideas)"La ciudad de los niños" (ideas)
"La ciudad de los niños" (ideas)
 
sistema de riego para cultivo
sistema de riego para cultivosistema de riego para cultivo
sistema de riego para cultivo
 
Color
ColorColor
Color
 

Similar to TDD, the way to better software | Dan Ursu | CodeWay 2015

iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven DevelopmentPablo Villar
 
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
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Developmentbhochhi
 
Getting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud ShaonGetting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud ShaonCefalo
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In ActionJon Kruger
 
Getting started with Test Driven Development
Getting started with Test Driven DevelopmentGetting started with Test Driven Development
Getting started with Test Driven DevelopmentFerdous Mahmud Shaon
 
Coderetreat @ CodersTUG
Coderetreat @ CodersTUGCoderetreat @ CodersTUG
Coderetreat @ CodersTUGMatteo Baglini
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential SkillsJohn Choi
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Developmentjakubkoci
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentSamnang Chhun
 
Unit testing
Unit testingUnit testing
Unit testingPiXeL16
 
2015 msu-code-review
2015 msu-code-review2015 msu-code-review
2015 msu-code-reviewc.titus.brown
 
Unleashing the power of Unit Testing - Franck Ninsabira.pdf
Unleashing the power of Unit Testing - Franck Ninsabira.pdfUnleashing the power of Unit Testing - Franck Ninsabira.pdf
Unleashing the power of Unit Testing - Franck Ninsabira.pdfGDG Bujumbura
 
Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?Danny van Kasteel
 
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
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1Blue Elephant Consulting
 
Los diez mandamientos de TDD
Los diez mandamientos de TDDLos diez mandamientos de TDD
Los diez mandamientos de TDDHernan Wilkinson
 

Similar to TDD, the way to better software | Dan Ursu | CodeWay 2015 (20)

iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
 
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)
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Getting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud ShaonGetting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud Shaon
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 
Getting started with Test Driven Development
Getting started with Test Driven DevelopmentGetting started with Test Driven Development
Getting started with Test Driven Development
 
Coderetreat @ CodersTUG
Coderetreat @ CodersTUGCoderetreat @ CodersTUG
Coderetreat @ CodersTUG
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential Skills
 
Intro to TDD
Intro to TDDIntro to TDD
Intro to TDD
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Tdd
TddTdd
Tdd
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Unit testing
Unit testingUnit testing
Unit testing
 
2015 msu-code-review
2015 msu-code-review2015 msu-code-review
2015 msu-code-review
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Unleashing the power of Unit Testing - Franck Ninsabira.pdf
Unleashing the power of Unit Testing - Franck Ninsabira.pdfUnleashing the power of Unit Testing - Franck Ninsabira.pdf
Unleashing the power of Unit Testing - Franck Ninsabira.pdf
 
Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?Unit Test Lab - Why Write Unit Tests?
Unit Test Lab - Why Write Unit Tests?
 
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
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1
 
Los diez mandamientos de TDD
Los diez mandamientos de TDDLos diez mandamientos de TDD
Los diez mandamientos de TDD
 

Recently uploaded

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
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
 
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
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
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
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
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
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
+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
 
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
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
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
 

Recently uploaded (20)

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
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
 
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 ...
 
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 girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort 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
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
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
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
+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...
 
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
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
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...
 

TDD, the way to better software | Dan Ursu | CodeWay 2015

  • 1. TDD, the way to better software by Ursu Dan Session 2/6 15:00 - 16:00 #Codeway Dan Ursu, iOS Developer YOPESO
  • 2. The Problem: Have you ever told said the following things
  • 3. “After the next release let’s put aside 3 days for refactoring” Manager’s thoughts: “Again with these arguments about clean code?”
  • 4. “This task requires me to change the architecture so it takes a long time” Manager’s thoughts: “ But it’s a simple button, why does a simple button cause an architectural change?”
  • 5. “I fixed one bug and 10 others popped up in another place” Manager’s thoughts: “I am starting to think you are unprofessional”
  • 6. “I’m not sure how the code works because the colleague who wrote it is on a vacation” Manager’s thoughts: “Really unprofessional”
  • 7. “I don’t clean this piece of ugly code because i’m afraid it will break things” Manager’s thoughts: “You sound highly incompetent”
  • 8. “I’ll finish the task and clean the code afterwards” Manager’s thoughts: 
 “Yet you always seem to set aside time for refactoring”
  • 9. You should never ask time for refactoring. You should refactor every time you see bad code. You never ask time to write good software, the same way Cooks don’t ask time to cook good food.
  • 10. So what is TDD?
  • 11. Test driven development is a discipline that eliminates fear of cleaning code.
  • 12. Demo Eliminate fear? What an interesting and fascinating idea.
  • 13. The 3 laws of TDD 1. You are not allowed to write any production code unless it is to make a failing unit test pass. 2. You are not allowed to write any more production code than is sufficient to pass the one failing unit test. 3. You are not allowed to write any more of a unit test than is sufficient to fail; 2 You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.2 3 You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
  • 14. 1. Write a failing unit test 2. Make the test pass by implementing it 3. Refactor Repeat until software is done TDD laws lock you into a cycle
  • 15. Credits TDD is popularized by Uncle Bob (real name Robert C. Martin)
  • 16. TDD in live demo
  • 17. I like those unit tests. Can i get a pair?
  • 18. So how do you get to TRUST your tests? Follow the 3 laws of TDD. Follow them always. If every line of code was written to make a failing unit test pass, you will trust your tests.
  • 19. Before making up your mind on to TDD
  • 20. 1. What would your life be if all your unit test would pass every minute or so?
  • 21. 2. Low level documentation. TDD generates a low level documentation so formal that it executes. It never gets old.
  • 22. 3. Since tests are written first they have a massive impact on your code. Writing tests first makes your code testable. And another word for testable is decoupled. You get a better design simply by writing your tests first.
  • 23. So you get: 
 1. Reduced debug time 2. Complete and reliable documentation 3. Improved design How much would you pay now for a suite of unit tests?
  • 24. Eliminate fear of changing and cleaning code.
  • 25. Consider this:
 Perfectly designed systems with no tests vs Bad design but fully covered with tests that you trust
  • 26. Objections to TDD Q: My manager doesn’t allow me to use TDD.
  • 27. Objections to TDD Q: Who tests the tests?
  • 28. Objections to TDD Q: Why not write tests at last?
  • 29. Objections to TDD Q: I already have a project which was not developed using TDD, so i won’t write tests because it’s too late.
  • 30. Objections to TDD Q: I’m working on an application with a cool UI and nothing else. You don't want me to write tests for the UI do you?
  • 31. Objections to TDD Q: Testing individual methods or classes is hard. Why not test the code through the User Interface. A: Because by the time you run your UI test, you would have written so much bad code, that a failing test can only confirm that human beings make mistakes. Testing individual methods provides feedback much faster, when its not too late.
  • 32. –Robert C. Martin “It is irresponsible to ship a single line of code without executing it in a test ”
  • 33. Conclusions 1. Code rots because we are afraid to clean it. 2. To keep a system clean we need to eliminate the fear 3. The only way to do that is by having a good suite of tests 4. In order to get the tests practice the 3 laws of TDD 5. TDD ties deeply into professionalism
  • 34. More Information Original TDD presentation https://cleancoders.com/episode/clean-code-episode-6-p1/show 17:00 - 18:00 Software architecture. Letting go of MVC by Ursu Dan