SlideShare a Scribd company logo
Test Driven DevelopmentTest Driven Development
Part 2
Gamal ShaabanGamal Shaaban
International Centers
Orange Labs Cairo
Mobile Applications & Software Development
2 Orange restricted
3 Orange restricted
Session-2Session-2
3
• The Three Rules Of TDD
• Legacy Code & Refactoring
• Code Smells
• Coupling And Cohesion
• Continues Integration
4 Orange restricted
THE THREE
RULES 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 of a unit
test than is sufficient to fail; and compilation
failures are failures.
3. You are not allowed to write any more
production code than is sufficient to pass the
one failing unit test.
 http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
4
5 Orange restricted
RefactoringRefactoring  Refactoring is one of the most important parts
of TDD, which means you need to refine the
code design as you add new tests.
 Refactoring should be done consistently as
you increment the software, adding tests and
production code.
 Make code easier to maintain in the future
 Use IDE when possible to do refactoring.
 Refactor Without Fear.
5
6 Orange restricted
Code SmellsCode Smells
A code smell is a surface indication that usually corresponds to
a deeper problem in the system.
Martin FowlerMartin Fowler
http://martinfowler.com/bliki/CodeSmell.html
6
7 Orange restricted
Smells To BeSmells To Be
RefactoredRefactored
1.Duplicated Code
2.Long Method
3.Large Class
4.Long Parameter List
5.Divergent Change
6.Lazy Class
7.Speculative Generality
8.Temporary Field
9.Data Class
10.Refused Bequest
11.Comments
12.MiddleMan
8 Orange restricted
COUPLING ANDCOUPLING AND
COHESIONCOHESION
 Maximize internal interaction
(cohesion)
• easier to understand
• easier to test
 Minimize external interaction
(coupling)
• can be used independently
• easier to test
• easier to replace
• easier to understand
8
9 Orange restricted
9
Degree of dependence
among components
No dependencies Loosely coupled-some dependencies
Highly coupled-many dependencies
10 Orange restricted
11 Orange restricted
CONTINUES INTEGRATION
12 Orange restricted
• Teams integrate their work multiple times
per day.
• Each integration is verified by an
automated build
• Significantly reduces integration problems
• Develop cohesive software more rapidly
Source: Martin Fowler
13 Orange restricted
Five Principles of Continuous Integration
• Environments based on stability
• Maintain a code repository
• Commit frequently and build every commit
• Make the build self-testing
• Store every build
13
14 Orange restrictedOrange presentation
Questions?
thanks

More Related Content

What's hot

Tdd
TddTdd
Code Smells Part 1: Basic Smells
Code Smells Part 1:  Basic SmellsCode Smells Part 1:  Basic Smells
Code Smells Part 1: Basic Smells
Nancy Henson
 
Refactoring, 2nd Edition
Refactoring, 2nd EditionRefactoring, 2nd Edition
Refactoring, 2nd Edition
jexp
 
TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDD
David Rodenas
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
Lim Chanmann
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
François Camus
 
Test driven development vs Behavior driven development
Test driven development vs Behavior driven developmentTest driven development vs Behavior driven development
Test driven development vs Behavior driven development
Gallop Solutions
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
Rachid Calazans
 
Testing concurrent java programs - Sameer Arora
Testing concurrent java programs - Sameer AroraTesting concurrent java programs - Sameer Arora
Testing concurrent java programs - Sameer Arora
IndicThreads
 
Test drive on driven development process
Test drive on driven development processTest drive on driven development process
Test drive on driven development process
Muralidharan Deenathayalan
 
TDD = bra design?
TDD = bra design?TDD = bra design?
TDD = bra design?
Kjetil Klaussen
 

What's hot (11)

Tdd
TddTdd
Tdd
 
Code Smells Part 1: Basic Smells
Code Smells Part 1:  Basic SmellsCode Smells Part 1:  Basic Smells
Code Smells Part 1: Basic Smells
 
Refactoring, 2nd Edition
Refactoring, 2nd EditionRefactoring, 2nd Edition
Refactoring, 2nd Edition
 
TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDD
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Test driven development vs Behavior driven development
Test driven development vs Behavior driven developmentTest driven development vs Behavior driven development
Test driven development vs Behavior driven development
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
 
Testing concurrent java programs - Sameer Arora
Testing concurrent java programs - Sameer AroraTesting concurrent java programs - Sameer Arora
Testing concurrent java programs - Sameer Arora
 
Test drive on driven development process
Test drive on driven development processTest drive on driven development process
Test drive on driven development process
 
TDD = bra design?
TDD = bra design?TDD = bra design?
TDD = bra design?
 

Viewers also liked

PlanMyDay remote_secretary
PlanMyDay remote_secretaryPlanMyDay remote_secretary
PlanMyDay remote_secretary
PlanMyDay
 
Pemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektualPemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektual
aliyahzahra
 
Cigarette
CigaretteCigarette
Cigarette
Bengi Koseoglu
 
Pemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektualPemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektual
aliyahzahra
 
ssk foundation. macam keajaiban dunia yang indah 2014
ssk foundation. macam keajaiban dunia yang indah 2014ssk foundation. macam keajaiban dunia yang indah 2014
ssk foundation. macam keajaiban dunia yang indah 2014
Nada Nafisah
 
Pemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektualPemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektual
aliyahzahra
 
Orange developers day-Application Caching
Orange developers day-Application CachingOrange developers day-Application Caching
Orange developers day-Application Caching
Gamal Shaban
 
Author and Audience
Author and Audience Author and Audience
Author and Audience
loisboylan
 
Orange developers day - Hibernate Search Workshop
Orange developers day - Hibernate Search WorkshopOrange developers day - Hibernate Search Workshop
Orange developers day - Hibernate Search Workshop
Gamal Shaban
 
Montaje
MontajeMontaje
Montaje
encarnika
 
Pemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektualPemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektual
aliyahzahra
 
Test Driven Development Part 1
Test Driven Development Part 1Test Driven Development Part 1
Test Driven Development Part 1
Gamal Shaban
 
Inquiry based labs
Inquiry based labsInquiry based labs
Inquiry based labs
corinne01
 
Time management
Time managementTime management
Time management
PlanMyDay
 
Spring session
Spring sessionSpring session
Spring session
Gamal Shaban
 
Hücre ve organeller
Hücre ve organellerHücre ve organeller
Hücre ve organellerTuba Turgutlu
 
It Takes a Village: How Data Projects Succeed
It Takes a Village: How Data Projects SucceedIt Takes a Village: How Data Projects Succeed
It Takes a Village: How Data Projects Succeed
Amy Gaskins
 

Viewers also liked (18)

PlanMyDay remote_secretary
PlanMyDay remote_secretaryPlanMyDay remote_secretary
PlanMyDay remote_secretary
 
Pemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektualPemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektual
 
Cigarette
CigaretteCigarette
Cigarette
 
Montaje
MontajeMontaje
Montaje
 
Pemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektualPemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektual
 
ssk foundation. macam keajaiban dunia yang indah 2014
ssk foundation. macam keajaiban dunia yang indah 2014ssk foundation. macam keajaiban dunia yang indah 2014
ssk foundation. macam keajaiban dunia yang indah 2014
 
Pemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektualPemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektual
 
Orange developers day-Application Caching
Orange developers day-Application CachingOrange developers day-Application Caching
Orange developers day-Application Caching
 
Author and Audience
Author and Audience Author and Audience
Author and Audience
 
Orange developers day - Hibernate Search Workshop
Orange developers day - Hibernate Search WorkshopOrange developers day - Hibernate Search Workshop
Orange developers day - Hibernate Search Workshop
 
Montaje
MontajeMontaje
Montaje
 
Pemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektualPemahaman tentang hak kekayaan intelektual
Pemahaman tentang hak kekayaan intelektual
 
Test Driven Development Part 1
Test Driven Development Part 1Test Driven Development Part 1
Test Driven Development Part 1
 
Inquiry based labs
Inquiry based labsInquiry based labs
Inquiry based labs
 
Time management
Time managementTime management
Time management
 
Spring session
Spring sessionSpring session
Spring session
 
Hücre ve organeller
Hücre ve organellerHücre ve organeller
Hücre ve organeller
 
It Takes a Village: How Data Projects Succeed
It Takes a Village: How Data Projects SucceedIt Takes a Village: How Data Projects Succeed
It Takes a Village: How Data Projects Succeed
 

Similar to Test Driven Development Part 2

Test-Driven Development Reference Card
Test-Driven Development Reference CardTest-Driven Development Reference Card
Test-Driven Development Reference Card
Seapine Software
 
REST API level TDD with NodeJS
REST API level TDD with NodeJSREST API level TDD with NodeJS
REST API level TDD with NodeJS
Dang Viet Ha (Tony)
 
REST API-LEVEL TDD With Nodejs
REST API-LEVEL TDD With NodejsREST API-LEVEL TDD With Nodejs
REST API-LEVEL TDD With Nodejs
Dang Viet Ha (Tony)
 
Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014
Pedro Santos
 
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
DevDay Da Nang
 
Test Drive Development
Test Drive DevelopmentTest Drive Development
Test Drive Development
satya sudheer
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
bhochhi
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Sachithra Gayan
 
Best pratice
Best praticeBest pratice
Best pratice
Eugenio Romano
 
Test Driven Development - Tulsa TechFest 2009
Test Driven Development - Tulsa TechFest 2009Test Driven Development - Tulsa TechFest 2009
Test Driven Development - Tulsa TechFest 2009
Jason Ragsdale
 
Test Driven Development - 09/2009
Test Driven Development - 09/2009Test Driven Development - 09/2009
Test Driven Development - 09/2009
Jason Ragsdale
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Jason Ragsdale
 
Test driven development
Test driven developmentTest driven development
Test driven development
Fraboni Ec
 
Test driven development
Test driven developmentTest driven development
Test driven development
Harry Potter
 
Test driven development
Test driven developmentTest driven development
Test driven development
Luis Goldster
 
Test driven development
Test driven developmentTest driven development
Test driven development
Tony Nguyen
 
Test driven development
Test driven developmentTest driven development
Test driven development
Young Alista
 
Test driven development
Test driven developmentTest driven development
Test driven development
James Wong
 
Software Testing, Everyone's responsibility
Software Testing, Everyone's responsibilitySoftware Testing, Everyone's responsibility
Software Testing, Everyone's responsibility
Kurt Bliefernich
 
Quick Intro to Clean Coding
Quick Intro to Clean CodingQuick Intro to Clean Coding
Quick Intro to Clean Coding
Ecommerce Solution Provider SysIQ
 

Similar to Test Driven Development Part 2 (20)

Test-Driven Development Reference Card
Test-Driven Development Reference CardTest-Driven Development Reference Card
Test-Driven Development Reference Card
 
REST API level TDD with NodeJS
REST API level TDD with NodeJSREST API level TDD with NodeJS
REST API level TDD with NodeJS
 
REST API-LEVEL TDD With Nodejs
REST API-LEVEL TDD With NodejsREST API-LEVEL TDD With Nodejs
REST API-LEVEL TDD With Nodejs
 
Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014
 
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
 
Test Drive Development
Test Drive DevelopmentTest Drive Development
Test Drive Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Best pratice
Best praticeBest pratice
Best pratice
 
Test Driven Development - Tulsa TechFest 2009
Test Driven Development - Tulsa TechFest 2009Test Driven Development - Tulsa TechFest 2009
Test Driven Development - Tulsa TechFest 2009
 
Test Driven Development - 09/2009
Test Driven Development - 09/2009Test Driven Development - 09/2009
Test Driven Development - 09/2009
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Software Testing, Everyone's responsibility
Software Testing, Everyone's responsibilitySoftware Testing, Everyone's responsibility
Software Testing, Everyone's responsibility
 
Quick Intro to Clean Coding
Quick Intro to Clean CodingQuick Intro to Clean Coding
Quick Intro to Clean Coding
 

Recently uploaded

A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 

Test Driven Development Part 2

  • 1. Test Driven DevelopmentTest Driven Development Part 2 Gamal ShaabanGamal Shaaban International Centers Orange Labs Cairo Mobile Applications & Software Development
  • 3. 3 Orange restricted Session-2Session-2 3 • The Three Rules Of TDD • Legacy Code & Refactoring • Code Smells • Coupling And Cohesion • Continues Integration
  • 4. 4 Orange restricted THE THREE RULES 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 of a unit test than is sufficient to fail; and compilation failures are failures. 3. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.  http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd 4
  • 5. 5 Orange restricted RefactoringRefactoring  Refactoring is one of the most important parts of TDD, which means you need to refine the code design as you add new tests.  Refactoring should be done consistently as you increment the software, adding tests and production code.  Make code easier to maintain in the future  Use IDE when possible to do refactoring.  Refactor Without Fear. 5
  • 6. 6 Orange restricted Code SmellsCode Smells A code smell is a surface indication that usually corresponds to a deeper problem in the system. Martin FowlerMartin Fowler http://martinfowler.com/bliki/CodeSmell.html 6
  • 7. 7 Orange restricted Smells To BeSmells To Be RefactoredRefactored 1.Duplicated Code 2.Long Method 3.Large Class 4.Long Parameter List 5.Divergent Change 6.Lazy Class 7.Speculative Generality 8.Temporary Field 9.Data Class 10.Refused Bequest 11.Comments 12.MiddleMan
  • 8. 8 Orange restricted COUPLING ANDCOUPLING AND COHESIONCOHESION  Maximize internal interaction (cohesion) • easier to understand • easier to test  Minimize external interaction (coupling) • can be used independently • easier to test • easier to replace • easier to understand 8
  • 9. 9 Orange restricted 9 Degree of dependence among components No dependencies Loosely coupled-some dependencies Highly coupled-many dependencies
  • 12. 12 Orange restricted • Teams integrate their work multiple times per day. • Each integration is verified by an automated build • Significantly reduces integration problems • Develop cohesive software more rapidly Source: Martin Fowler
  • 13. 13 Orange restricted Five Principles of Continuous Integration • Environments based on stability • Maintain a code repository • Commit frequently and build every commit • Make the build self-testing • Store every build 13
  • 14. 14 Orange restrictedOrange presentation Questions?

Editor's Notes

  1. “TDD Intro” Is all code guilty until proven innocent??? can we find out?
  2. Duplicated Code :bad because if you modify one instance of duplicated code but not the others, you (may) have introduced a bug! Long Method :long methods are more difficult to understand performance concerns with respect to lots of short methods are largely obsolete Large Class: classes try to do too much, which reduces cohesion Long Parameter List : hard to understand, can become inconsistent Divergent Change: Related to cohesion: symptom: one type of change requires changing one subset of methods; another type of change requires changing another subset Lazy Class : A class that no longer “pays its way” e.g. may be a class that was downsized by a previous refactoring, or represented planned functionality that did not pan out Speculative Generality : “Oh I think we need the ability to do this kind of thing someday” Temporary Field : An attribute of an object is only set in certain circumstances; but an object should need all of its attributes More: http://c2.com/cgi/wiki?CodeSmell http://www.industriallogic.com/wp-content/uploads/2005/09/smellstorefactorings.pdf
  3. http://stackoverflow.com/questions/39946/coupling-and-cohesion
  4. Environments based on stability Maintain a code repository Commit frequently and build every commit Make the build self-testing Store every build