SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
HOW DO YOU HANDLE 
BIG REFACTORING WITH AGILE 
METHODOLOGIES? 
Luca Merolla
What is code refactoring?
CODE REFACTORING 
“Process to change the existing code without changing 
its external behavior. 
Refactoring improves nonfunctional attributes 
of the software”
Why we need code 
refactoring?
WHY REFACTORING? 
Some arguments : 
❏ Quality 
❏ Code Clean 
❏ Better Design 
❏ Right Thing
WHY REFACTORING? 
Some arguments : 
❏ Quality 
❏ Code Clean 
❏ Better Design 
❏ Right Thing 
Good Luck!
WHY REFACTORING? 
The only “sellable” reason to do refactoring is
WHY REFACTORING? 
The only “sellable” reason to do refactoring is
WHY REFACTORING? 
The only “sellable” reason to do refactoring is 
Save money Faster to deliver new 
functionalities
WHY REFACTORING?
When to do refactoring?
WHEN REFACTORING? 
Ideally, when we identify: 
❏ Code Smells: Things are not right 
❏ WTFs: Code is not understandable 
❏ It should be different: Product evolved
WHEN REFACTORING? 
Don’t clean up everything. 
It should be a constant and 
gradual improvement
WHEN REFACTORING? 
Keep the balance between: 
refactoring vs new features 
Don't refactor unless you think it will pay off later by 
allowing faster feature delivery
How to do refactoring? 
<
HOW TO REFACTOR? 
From the methodology point of view, my experience 
tells me that: 
❏ Revolutionary design is evil 
❏ Evolutionary design is good
HOW TO REFACTOR? 
The most common approaches about refactoring are: 
❏ “Big Bang” 
❏ “Divide and Conquer” 
❏ Planned refactoring
HOW TO REFACTOR? 
The “Big Bang” approach: 
❏ Define a new structure for your code 
❏ Move the code to the new structure 
❏ Rebuild the puzzle 
❏ Make tests green again!
HOW TO REFACTOR? 
The “Big Bang” approach: 
❏ Define a new structure for your code 
❏ Move the code to the new structure 
❏ Rebuild the puzzle 
❏ Make tests green again! 
❏ High risks! 
❏ Almost like rewrite from scratch
HOW TO REFACTOR? 
The “Divide and Conquer” approach: 
❏ Define a Vision 
❏ Break the application into pieces 
❏ Rebuild the puzzle 
❏ Make tests green again!
HOW TO REFACTOR? 
The “Divide and Conquer” approach: 
❏ Define a Vision 
❏ Break the application into pieces 
❏ Rebuild the puzzle 
❏ Make tests green again! 
❏ Difficult estimation (like bugs) 
❏ Code could be “undeliverable” for 
long period
HOW TO REFACTOR? 
Planned Refactoring also called as Stabilization 
periods: 
❏ No new features developed (Code freeze period) 
❏ Work without adding Value 
❏ Not an improvement for the customer
HOW TO REFACTOR? 
Planned Refactoring also called as Stabilization 
periods: 
❏ No new features developed (Code freeze period) 
❏ Work without adding Value 
❏ Not an improvement for the customer 
❏ It’s a Methodology Smell! 
❏ No real “value” added to the 
application
HOW TO REFACTOR? 
What a Good Team does is: 
❏ Define a Vision 
❏ Break it into smaller tasks 
❏ Refactoring all the time (part of regular work) 
❏ Responsible (Diligently keep the code clean)
HOW TO REFACTOR? 
What a Good Team does is: 
❏ Define a Vision 
❏ Break it into smaller tasks 
❏ Refactoring all the time (part of regular work) 
❏ Responsible (Diligently keep the code clean) 
❏ Code can be delivered (often) 
❏ New features benefits from the 
refactor (faster to develop)
How much refactoring should 
we be doing? 
<
HOW MUCH REFACTOR? 
We need to always consider the benefits of 
refactoring 
❏ Tolerance level (metrics could help) 
❏ Don’t clean up everything 
❏ Make refactoring part of our daily work 
❏ Multiple small improvements 
❏ Don’t refactor what is not likely to change 
❏ Consider the economic factor: 
Cleaner code ⇹ Quicker and Cheaper changes
How can we obtain 
Refactoring with Agile 
Methodologies?
AGILE & REFACTOR? 
Agile Methodologies focuses on continuous (or at 
least frequent) Value delivery. 
The Value (for the customer) is realized when the 
product is shipped in production, not before.
AGILE & REFACTOR? 
In order to use Agile Methodologies for big 
refactoring, we need to enforce some practices: 
❏ Define and communicate the Vision 
❏ Start with small tasks 
❏ Iterate and Learn
VISION 
Where to go MUST be clear.
Small Steps 
(Tasks) are 
easier to 
handle
Iterate and Learn 
throughout 
the process
Which Tools and Techniques 
should we use?
TOOLS & TECHNIQUES 
There are different tools and techniques that can help 
us to be more agile and deliver more often: 
❏ Trunk Based Development 
❏ Branch By Abstraction 
❏ Feature Toggles/Flags
What is Trunk Based 
Development?
TRUNK BASED DEV. 
Branches act as an Isolation from the “real world”.
TRUNK BASED DEV. 
Multi branches 
can make the 
code 
undeployable 
for long 
periods 
● Undeployable 
● Deployable
TRUNK BASED DEV. 
What is really wrong with Branches? 
❏ Branching is not bad, long lived branches are bad 
❏ “Isolation” for prolonged periods of time is bad 
❏ Multi-branches can lead to undeployable code
TRUNK BASED DEV. 
How does TBD look like?
TRUNK BASED DEV. 
What are the benefits of TBD? 
❏ Work on a single shared trunk 
❏ Always work against the latest code 
❏ Merge and integration pain is minimised 
Note: 
❏ TBD does not prohibit branching
TRUNK BASED DEV. 
F FIX TBD Optimistic Branching 
R D ? 
R RELEASED 
DEVELOPED NO COMMITS YET 
D ? 
209 210 211 TRUNK 
209.x 
FIX 
R 
209.1 
R D F 
? 
209 210 211 TRUNK
TRUNK BASED DEV. 
TBD Pessimistic Branching 
R RELEASED 
F FIX DEVELOPED NO COMMITS YET 
D ? 
209.x 
? 
R D ? 
209 210 211 TRUNK 
209.x 
R D 
R 
211.x 
? 
209 210 211 TRUNK 
209.x 
R D 
FIX 
R 
209.1 
F 
R 
211.x 
? 
209 210 211 TRUNK
What is Branch By Abstraction?
BRANCH BY ABSTRACTION 
1. Introduce an abstraction layer 
2. Update all the code to rely on the abstraction 
3. Make new implementation of the abstraction 
4. Remove the old implementation
BRANCH BY ABSTRACTION 
⇒ 
⇒
What are feature toggles/flags?
TOGGLES & FLAGS? 
What are the advantages of using Feature Toggles: 
❏ Decouples code deployment from feature 
❏ No need to rollback (disable the feature) 
❏ A/B testing 
❏ Deliver features to specific users only 
❏ Continuous delivery
THANK YOU! 
Questions? 
@lucamerolla

Mais conteĂșdo relacionado

Mais procurados

Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
toteb5
 
Agile and ATDD the perfect couple
Agile and ATDD the perfect coupleAgile and ATDD the perfect couple
Agile and ATDD the perfect couple
Stephen Tucker
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Zohirul Alam Tiemoon
 
optimizing code in compilers using parallel genetic algorithm
optimizing code in compilers using parallel genetic algorithm optimizing code in compilers using parallel genetic algorithm
optimizing code in compilers using parallel genetic algorithm
Fatemeh Karimi
 

Mais procurados (20)

TDD And Refactoring
TDD And RefactoringTDD And Refactoring
TDD And Refactoring
 
Extreme Programming
Extreme ProgrammingExtreme Programming
Extreme Programming
 
TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
 
Agile Programming Systems # TDD intro
Agile Programming Systems # TDD introAgile Programming Systems # TDD intro
Agile Programming Systems # TDD intro
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Agile and ATDD the perfect couple
Agile and ATDD the perfect coupleAgile and ATDD the perfect couple
Agile and ATDD the perfect couple
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
VT.NET 20160411: An Intro to Test Driven Development (TDD)
VT.NET 20160411: An Intro to Test Driven Development (TDD)VT.NET 20160411: An Intro to Test Driven Development (TDD)
VT.NET 20160411: An Intro to Test Driven Development (TDD)
 
Acceptance Test Driven Development
Acceptance Test Driven DevelopmentAcceptance Test Driven Development
Acceptance Test Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Agile Test Driven Development
Agile Test Driven DevelopmentAgile Test Driven Development
Agile Test Driven Development
 
Automation and Technical Debt
Automation and Technical DebtAutomation and Technical Debt
Automation and Technical Debt
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
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
 
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
Overview on TDD (Test Driven Development) & ATDD (Acceptance Test Driven Deve...
 
TDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & WhereTDD vs. ATDD - What, Why, Which, When & Where
TDD vs. ATDD - What, Why, Which, When & Where
 
TDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionTDD Flow: The Mantra in Action
TDD Flow: The Mantra in Action
 
optimizing code in compilers using parallel genetic algorithm
optimizing code in compilers using parallel genetic algorithm optimizing code in compilers using parallel genetic algorithm
optimizing code in compilers using parallel genetic algorithm
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)
 

Destaque

Why we used Feature Branching
Why we used Feature BranchingWhy we used Feature Branching
Why we used Feature Branching
Alan Parkinson
 
Trunk Based Development (CBSoft 2011)
Trunk Based Development (CBSoft 2011)Trunk Based Development (CBSoft 2011)
Trunk Based Development (CBSoft 2011)
Wildtech
 
Strategies in continuous delivery
Strategies in continuous deliveryStrategies in continuous delivery
Strategies in continuous delivery
Aviran Mordo
 
Feature Toggles
Feature TogglesFeature Toggles
Feature Toggles
Devi Sridharan
 

Destaque (20)

Refactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech TalkRefactoring for Software Design Smells - Tech Talk
Refactoring for Software Design Smells - Tech Talk
 
Multiple projects, different goals, one thing in common: the codebase!
Multiple projects, different goals, one thing in common: the codebase!Multiple projects, different goals, one thing in common: the codebase!
Multiple projects, different goals, one thing in common: the codebase!
 
Merge hells - Feature Toggles to the rescue
Merge hells - Feature Toggles to the rescueMerge hells - Feature Toggles to the rescue
Merge hells - Feature Toggles to the rescue
 
Feature Toggles On Steroids
Feature Toggles On SteroidsFeature Toggles On Steroids
Feature Toggles On Steroids
 
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsTrunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and Economics
 
Porque Odeio Branches
Porque Odeio BranchesPorque Odeio Branches
Porque Odeio Branches
 
Refactoring for Software Design Smells
Refactoring for Software Design SmellsRefactoring for Software Design Smells
Refactoring for Software Design Smells
 
Overcoming the fear of deployments
Overcoming the fear of deploymentsOvercoming the fear of deployments
Overcoming the fear of deployments
 
Continuous Visual Integration - RailsConf 2016 - Mike Fotinakis - Percy.io
Continuous Visual Integration - RailsConf 2016 - Mike Fotinakis - Percy.ioContinuous Visual Integration - RailsConf 2016 - Mike Fotinakis - Percy.io
Continuous Visual Integration - RailsConf 2016 - Mike Fotinakis - Percy.io
 
Pull requests and testers can be friends
Pull requests and testers can be friendsPull requests and testers can be friends
Pull requests and testers can be friends
 
Who will test your tests?
Who will test your tests?Who will test your tests?
Who will test your tests?
 
Entregas ContĂ­nuas com feature toggles
Entregas ContĂ­nuas com feature togglesEntregas ContĂ­nuas com feature toggles
Entregas ContĂ­nuas com feature toggles
 
Continuous Integration, Delivery and Deployment
Continuous Integration, Delivery and DeploymentContinuous Integration, Delivery and Deployment
Continuous Integration, Delivery and Deployment
 
Why we used Feature Branching
Why we used Feature BranchingWhy we used Feature Branching
Why we used Feature Branching
 
Requirement and Test for Continuous Delivery - Customer in focus at Scania Co...
Requirement and Test for Continuous Delivery - Customer in focus at Scania Co...Requirement and Test for Continuous Delivery - Customer in focus at Scania Co...
Requirement and Test for Continuous Delivery - Customer in focus at Scania Co...
 
Trunk Based Development (CBSoft 2011)
Trunk Based Development (CBSoft 2011)Trunk Based Development (CBSoft 2011)
Trunk Based Development (CBSoft 2011)
 
Feature Toggle Examples
Feature Toggle ExamplesFeature Toggle Examples
Feature Toggle Examples
 
Feature Flags Are Flawed: Let's Make Them Better
Feature Flags Are Flawed: Let's Make Them BetterFeature Flags Are Flawed: Let's Make Them Better
Feature Flags Are Flawed: Let's Make Them Better
 
Strategies in continuous delivery
Strategies in continuous deliveryStrategies in continuous delivery
Strategies in continuous delivery
 
Feature Toggles
Feature TogglesFeature Toggles
Feature Toggles
 

Semelhante a Big code refactoring with agility

The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practices
Bill Buchan
 

Semelhante a Big code refactoring with agility (20)

The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practices
 
Unit testing traning
Unit testing traningUnit testing traning
Unit testing traning
 
DevOps and Cloud
DevOps and CloudDevOps and Cloud
DevOps and Cloud
 
So You Want to Rewrite That...
So You Want to Rewrite That...So You Want to Rewrite That...
So You Want to Rewrite That...
 
Software Craftsmanship @ Ntnu
Software Craftsmanship @ NtnuSoftware Craftsmanship @ Ntnu
Software Craftsmanship @ Ntnu
 
Perfect product architecture in a non-stop start-up
Perfect product architecture in a non-stop start-upPerfect product architecture in a non-stop start-up
Perfect product architecture in a non-stop start-up
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Hardening
HardeningHardening
Hardening
 
Understand the system
Understand the systemUnderstand the system
Understand the system
 
Tdd!
Tdd!Tdd!
Tdd!
 
How BDD enables True CI/CD
How BDD enables True CI/CDHow BDD enables True CI/CD
How BDD enables True CI/CD
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy
 
How have we developed product without bugs
How have we developed product without bugsHow have we developed product without bugs
How have we developed product without bugs
 
You cant be agile if your code sucks
You cant be agile if your code sucksYou cant be agile if your code sucks
You cant be agile if your code sucks
 
Test Driven Development with Laravel
Test Driven Development with LaravelTest Driven Development with Laravel
Test Driven Development with Laravel
 
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)
 
The Power of Refactoring
The Power of RefactoringThe Power of Refactoring
The Power of Refactoring
 
TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDD
 
Continuous Delivery for Agile Teams
Continuous Delivery for Agile TeamsContinuous Delivery for Agile Teams
Continuous Delivery for Agile Teams
 
The Power Of Refactoring (PHPCon Italia)
The Power Of Refactoring (PHPCon Italia)The Power Of Refactoring (PHPCon Italia)
The Power Of Refactoring (PHPCon Italia)
 

Mais de Luca Merolla (6)

Fundraising in chaotic environments
Fundraising in chaotic environmentsFundraising in chaotic environments
Fundraising in chaotic environments
 
How to raise money in a digital world
How to raise money in a digital worldHow to raise money in a digital world
How to raise money in a digital world
 
The Learning Organization
The Learning OrganizationThe Learning Organization
The Learning Organization
 
Innovation in Large Enterprises
Innovation in Large EnterprisesInnovation in Large Enterprises
Innovation in Large Enterprises
 
Event Sito
Event SitoEvent Sito
Event Sito
 
Introduction to Crowdfunding
Introduction to CrowdfundingIntroduction to Crowdfunding
Introduction to Crowdfunding
 

Último

Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Último (20)

Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] đŸ„ Women's Abortion Clinic in T...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 

Big code refactoring with agility

  • 1. HOW DO YOU HANDLE BIG REFACTORING WITH AGILE METHODOLOGIES? Luca Merolla
  • 2. What is code refactoring?
  • 3. CODE REFACTORING “Process to change the existing code without changing its external behavior. Refactoring improves nonfunctional attributes of the software”
  • 4. Why we need code refactoring?
  • 5. WHY REFACTORING? Some arguments : ❏ Quality ❏ Code Clean ❏ Better Design ❏ Right Thing
  • 6. WHY REFACTORING? Some arguments : ❏ Quality ❏ Code Clean ❏ Better Design ❏ Right Thing Good Luck!
  • 7. WHY REFACTORING? The only “sellable” reason to do refactoring is
  • 8. WHY REFACTORING? The only “sellable” reason to do refactoring is
  • 9. WHY REFACTORING? The only “sellable” reason to do refactoring is Save money Faster to deliver new functionalities
  • 11. When to do refactoring?
  • 12. WHEN REFACTORING? Ideally, when we identify: ❏ Code Smells: Things are not right ❏ WTFs: Code is not understandable ❏ It should be different: Product evolved
  • 13. WHEN REFACTORING? Don’t clean up everything. It should be a constant and gradual improvement
  • 14. WHEN REFACTORING? Keep the balance between: refactoring vs new features Don't refactor unless you think it will pay off later by allowing faster feature delivery
  • 15. How to do refactoring? <
  • 16. HOW TO REFACTOR? From the methodology point of view, my experience tells me that: ❏ Revolutionary design is evil ❏ Evolutionary design is good
  • 17. HOW TO REFACTOR? The most common approaches about refactoring are: ❏ “Big Bang” ❏ “Divide and Conquer” ❏ Planned refactoring
  • 18. HOW TO REFACTOR? The “Big Bang” approach: ❏ Define a new structure for your code ❏ Move the code to the new structure ❏ Rebuild the puzzle ❏ Make tests green again!
  • 19. HOW TO REFACTOR? The “Big Bang” approach: ❏ Define a new structure for your code ❏ Move the code to the new structure ❏ Rebuild the puzzle ❏ Make tests green again! ❏ High risks! ❏ Almost like rewrite from scratch
  • 20. HOW TO REFACTOR? The “Divide and Conquer” approach: ❏ Define a Vision ❏ Break the application into pieces ❏ Rebuild the puzzle ❏ Make tests green again!
  • 21. HOW TO REFACTOR? The “Divide and Conquer” approach: ❏ Define a Vision ❏ Break the application into pieces ❏ Rebuild the puzzle ❏ Make tests green again! ❏ Difficult estimation (like bugs) ❏ Code could be “undeliverable” for long period
  • 22. HOW TO REFACTOR? Planned Refactoring also called as Stabilization periods: ❏ No new features developed (Code freeze period) ❏ Work without adding Value ❏ Not an improvement for the customer
  • 23. HOW TO REFACTOR? Planned Refactoring also called as Stabilization periods: ❏ No new features developed (Code freeze period) ❏ Work without adding Value ❏ Not an improvement for the customer ❏ It’s a Methodology Smell! ❏ No real “value” added to the application
  • 24. HOW TO REFACTOR? What a Good Team does is: ❏ Define a Vision ❏ Break it into smaller tasks ❏ Refactoring all the time (part of regular work) ❏ Responsible (Diligently keep the code clean)
  • 25. HOW TO REFACTOR? What a Good Team does is: ❏ Define a Vision ❏ Break it into smaller tasks ❏ Refactoring all the time (part of regular work) ❏ Responsible (Diligently keep the code clean) ❏ Code can be delivered (often) ❏ New features benefits from the refactor (faster to develop)
  • 26. How much refactoring should we be doing? <
  • 27. HOW MUCH REFACTOR? We need to always consider the benefits of refactoring ❏ Tolerance level (metrics could help) ❏ Don’t clean up everything ❏ Make refactoring part of our daily work ❏ Multiple small improvements ❏ Don’t refactor what is not likely to change ❏ Consider the economic factor: Cleaner code ⇹ Quicker and Cheaper changes
  • 28. How can we obtain Refactoring with Agile Methodologies?
  • 29. AGILE & REFACTOR? Agile Methodologies focuses on continuous (or at least frequent) Value delivery. The Value (for the customer) is realized when the product is shipped in production, not before.
  • 30. AGILE & REFACTOR? In order to use Agile Methodologies for big refactoring, we need to enforce some practices: ❏ Define and communicate the Vision ❏ Start with small tasks ❏ Iterate and Learn
  • 31. VISION Where to go MUST be clear.
  • 32. Small Steps (Tasks) are easier to handle
  • 33. Iterate and Learn throughout the process
  • 34. Which Tools and Techniques should we use?
  • 35. TOOLS & TECHNIQUES There are different tools and techniques that can help us to be more agile and deliver more often: ❏ Trunk Based Development ❏ Branch By Abstraction ❏ Feature Toggles/Flags
  • 36. What is Trunk Based Development?
  • 37. TRUNK BASED DEV. Branches act as an Isolation from the “real world”.
  • 38. TRUNK BASED DEV. Multi branches can make the code undeployable for long periods ● Undeployable ● Deployable
  • 39. TRUNK BASED DEV. What is really wrong with Branches? ❏ Branching is not bad, long lived branches are bad ❏ “Isolation” for prolonged periods of time is bad ❏ Multi-branches can lead to undeployable code
  • 40. TRUNK BASED DEV. How does TBD look like?
  • 41. TRUNK BASED DEV. What are the benefits of TBD? ❏ Work on a single shared trunk ❏ Always work against the latest code ❏ Merge and integration pain is minimised Note: ❏ TBD does not prohibit branching
  • 42. TRUNK BASED DEV. F FIX TBD Optimistic Branching R D ? R RELEASED DEVELOPED NO COMMITS YET D ? 209 210 211 TRUNK 209.x FIX R 209.1 R D F ? 209 210 211 TRUNK
  • 43. TRUNK BASED DEV. TBD Pessimistic Branching R RELEASED F FIX DEVELOPED NO COMMITS YET D ? 209.x ? R D ? 209 210 211 TRUNK 209.x R D R 211.x ? 209 210 211 TRUNK 209.x R D FIX R 209.1 F R 211.x ? 209 210 211 TRUNK
  • 44. What is Branch By Abstraction?
  • 45. BRANCH BY ABSTRACTION 1. Introduce an abstraction layer 2. Update all the code to rely on the abstraction 3. Make new implementation of the abstraction 4. Remove the old implementation
  • 46. BRANCH BY ABSTRACTION ⇒ ⇒
  • 47. What are feature toggles/flags?
  • 48. TOGGLES & FLAGS? What are the advantages of using Feature Toggles: ❏ Decouples code deployment from feature ❏ No need to rollback (disable the feature) ❏ A/B testing ❏ Deliver features to specific users only ❏ Continuous delivery
  • 49. THANK YOU! Questions? @lucamerolla