SlideShare uma empresa Scribd logo
1 de 63
Baixar para ler offline
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Unleashing the Power of
Automated Refactoring with JDT
Law of Diversity
Distrust all claims of ONE true way!
Naresh Jain
@nashjain
http://nareshjain.com
naresh@agilefaqs.com
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Plan
What and Why... Refactor?
Automated Refactoring Demo 1 with JDT
When and How... Refactor?
Automated Refactoring Demo 2 with JDT
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What is Refactoring?
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What is Refactoring?
A series of small steps, each of which changes the
program’s internal structure without changing its
external behaviour - Martin Fowler
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
Can you refactor the code so that it authenticates against LDAP instead
of Database?
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
Can you refactor the code so that it authenticates against LDAP instead
of Database?
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
Can you refactor the code so that it authenticates against LDAP instead
of Database?
We have too much duplicate code, we need to refactor the code to
eliminate duplication
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
Can you refactor the code so that it authenticates against LDAP instead
of Database?
We have too much duplicate code, we need to refactor the code to
eliminate duplication
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
Can you refactor the code so that it authenticates against LDAP instead
of Database?
We have too much duplicate code, we need to refactor the code to
eliminate duplication
This class is too big, we need to refactor it
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
Can you refactor the code so that it authenticates against LDAP instead
of Database?
We have too much duplicate code, we need to refactor the code to
eliminate duplication
This class is too big, we need to refactor it
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
Can you refactor the code so that it authenticates against LDAP instead
of Database?
We have too much duplicate code, we need to refactor the code to
eliminate duplication
This class is too big, we need to refactor it
In-Memory Object Caching?
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
What if you hear...
We’ll just refactor the code to support logging
Can you refactor the code so that it authenticates against LDAP instead
of Database?
We have too much duplicate code, we need to refactor the code to
eliminate duplication
This class is too big, we need to refactor it
In-Memory Object Caching?
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Origin
Ward Cunningham and Kent Beck
Smalltalk style
Ralph Johnson at University of Illinois at Urbana-
Champaign
Bill Opdyke’s Thesis
ftp://st.cs.uiuc.edu/pub/papers/refactoring/opdyke-
thesis.ps.Z
John Brant and Don Roberts:The Refactoring Browser
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Readability
Which code segment is easier to read?
Sample 1
if (date.Before(Summer_Start) || date.After(Summer_End)){
charge = quantity * winterRate + winterServiceCharge;
else
charge = quantity * summerRate;
}
Sample 2
if (IsSummer(date)) {
charge = SummerCharge(quantity);
else
charge = WinterCharge(quantity);
}
Commercial Break!
Copyright
© 2012,
Mumbai
Tech Talks!
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Automated Refactoring
Demo 1
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
How do we Refactor?
We looks for Code-Smells
Things that we suspect are not quite right or will cause us severe pain if
we do not fix
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
2 Piece of Advice before Refactoring
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
2 Piece of Advice before Refactoring
Baby Steps
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
2 Piece of Advice before Refactoring
Baby Steps
The Hippocratic Oath
First Do No Harm!
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Automated Refactoring
Demo 2
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Code Smells Lab
Long Method
Lazy class and
Speculative Generality Smell
Refused Bequest
Black Sheep
Duplicate Code
Switch Smell
Dead Code
Alternative Classes with different interface
Odd Ball solution
Primitive Obsession
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?
Helps us deliver more business value faster
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?
Helps us deliver more business value faster
Improves the design of our software
Combat’s “bit rot”
Easier to maintain and understand
Easier to facilitate change
More flexibility
Increased re-usability
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?...
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?...
Minimizes technical debt
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?...
Minimizes technical debt
Keep development at speed
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?...
Minimizes technical debt
Keep development at speed
To make the software easier to understand
Write for people, not the compiler
Understand unfamiliar code
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?...
Minimizes technical debt
Keep development at speed
To make the software easier to understand
Write for people, not the compiler
Understand unfamiliar code
To help find bugs
refactor while debugging to clarify the code
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Why do we Refactor?...
Minimizes technical debt
Keep development at speed
To make the software easier to understand
Write for people, not the compiler
Understand unfamiliar code
To help find bugs
refactor while debugging to clarify the code
To “Fix broken windows” - Pragmatic Programmers
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
When should you refactor?
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
When should you refactor?
To add new functionality
refactor existing code until you understand it
refactor the design to make it simple to add
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
When should you refactor?
To add new functionality
refactor existing code until you understand it
refactor the design to make it simple to add
To find bugs
refactor to understand the code
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
When should you refactor?
To add new functionality
refactor existing code until you understand it
refactor the design to make it simple to add
To find bugs
refactor to understand the code
For code reviews
immediate effect of code review
allows for higher level suggestions
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
When should you refactor?
To add new functionality
refactor existing code until you understand it
refactor the design to make it simple to add
To find bugs
refactor to understand the code
For code reviews
immediate effect of code review
allows for higher level suggestions
Like championship
snooker players we are
setting ourselves up for
our next shot
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
The Two Hats
Adding Function
Add new capabilities to the system
Adds new tests
Get the test working
Refactoring
Does not add any new features
Does not add tests (but may change some)
Restructure the code to remove redundancy
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
The Two Hats
Adding Function
Add new capabilities to the system
Adds new tests
Get the test working
Refactoring
Does not add any new features
Does not add tests (but may change some)
Restructure the code to remove redundancy
Swap frequently between the hats, but only wear one at a time
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Pass
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Fail
Pass
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Make a little change
Fail
Pass
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Make a little change
Run the Test
Fail
Pass
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Make a little change
Run the Test
Fail
Fail
Pass
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Make a little change
Run the Test
Fail
Pass
Fail
Pass
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Make a little change
Run the Test
Refactor
Fail
Pass
Fail
Pass
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Make a little change
Run the Test
Refactor
Fail
Pass
Fail
Pass
http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved.
Refactoring and TDD
TDD Rhythm - Test, Code, Refactor
Add a Test
Run the Test
Make a little change
Run the Test
Refactor
Fail
Pass
Fail
Pass
T H A N K Y O U !
Q U E S T I O N S ?
Naresh Jain
@nashjain
http://nareshjain.com

Mais conteúdo relacionado

Mais procurados

Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Simplilearn
 
Continuous Integration for Oracle Database Development
Continuous Integration for Oracle Database DevelopmentContinuous Integration for Oracle Database Development
Continuous Integration for Oracle Database Development
Vladimir Bakhov
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
Simplilearn
 
What is DevOps? | DevOps Introduction | DevOps Tools | DevOps Tutorial For Be...
What is DevOps? | DevOps Introduction | DevOps Tools | DevOps Tutorial For Be...What is DevOps? | DevOps Introduction | DevOps Tools | DevOps Tutorial For Be...
What is DevOps? | DevOps Introduction | DevOps Tools | DevOps Tutorial For Be...
Simplilearn
 

Mais procurados (20)

Building an Automated Database Deployment Pipeline
Building an Automated Database Deployment PipelineBuilding an Automated Database Deployment Pipeline
Building an Automated Database Deployment Pipeline
 
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
Introduction To DevOps | Devops Tutorial For Beginners | DevOps Training For ...
 
Devops online training ppt
Devops online training pptDevops online training ppt
Devops online training ppt
 
Devconf - Moving 65000 Microsofties to DevOps with Visual Studio Team Services
Devconf - Moving 65000 Microsofties to DevOps with Visual Studio Team ServicesDevconf - Moving 65000 Microsofties to DevOps with Visual Studio Team Services
Devconf - Moving 65000 Microsofties to DevOps with Visual Studio Team Services
 
Dev ops tutorial for beginners what is devops & devops tools
Dev ops tutorial for beginners what is devops & devops toolsDev ops tutorial for beginners what is devops & devops tools
Dev ops tutorial for beginners what is devops & devops tools
 
Continuous Delivery vs Continuous Deployment | DevOps Methodology | Devops Tr...
Continuous Delivery vs Continuous Deployment | DevOps Methodology | Devops Tr...Continuous Delivery vs Continuous Deployment | DevOps Methodology | Devops Tr...
Continuous Delivery vs Continuous Deployment | DevOps Methodology | Devops Tr...
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
Continuous Integration for Oracle Database Development
Continuous Integration for Oracle Database DevelopmentContinuous Integration for Oracle Database Development
Continuous Integration for Oracle Database Development
 
Automation CICD
Automation CICDAutomation CICD
Automation CICD
 
Devops Intro - Devops for Unicorns & DevOps for Horses
Devops Intro - Devops for Unicorns & DevOps for HorsesDevops Intro - Devops for Unicorns & DevOps for Horses
Devops Intro - Devops for Unicorns & DevOps for Horses
 
Continuous Delivery at Oracle Database Insights
Continuous Delivery at Oracle Database InsightsContinuous Delivery at Oracle Database Insights
Continuous Delivery at Oracle Database Insights
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
 
Devops Mindset Essentials
Devops Mindset EssentialsDevops Mindset Essentials
Devops Mindset Essentials
 
Top DevOps tools
Top DevOps toolsTop DevOps tools
Top DevOps tools
 
A New Approach to DevOps Software Product Development Solution
A New Approach to DevOps Software Product Development SolutionA New Approach to DevOps Software Product Development Solution
A New Approach to DevOps Software Product Development Solution
 
DevOps in a nutshell
DevOps in a nutshellDevOps in a nutshell
DevOps in a nutshell
 
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
 
What is DevOps? | DevOps Introduction | DevOps Tools | DevOps Tutorial For Be...
What is DevOps? | DevOps Introduction | DevOps Tools | DevOps Tutorial For Be...What is DevOps? | DevOps Introduction | DevOps Tools | DevOps Tutorial For Be...
What is DevOps? | DevOps Introduction | DevOps Tools | DevOps Tutorial For Be...
 
Agile Maintenance
Agile MaintenanceAgile Maintenance
Agile Maintenance
 
Introduction to CICD
Introduction to CICDIntroduction to CICD
Introduction to CICD
 

Semelhante a Unleashing the Power of Automated Refactoring with JDT

API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards   25-6-2014API Athens Meetup - API standards   25-6-2014
API Athens Meetup - API standards 25-6-2014
Michael Petychakis
 
Rapidly Building and Deploying Scalable Web Architectures
Rapidly Building and Deploying Scalable Web ArchitecturesRapidly Building and Deploying Scalable Web Architectures
Rapidly Building and Deploying Scalable Web Architectures
Keith Fitzgerald
 

Semelhante a Unleashing the Power of Automated Refactoring with JDT (20)

System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web Application
 
Mastering DevOps With Oracle
Mastering DevOps With OracleMastering DevOps With Oracle
Mastering DevOps With Oracle
 
WoMakersCode 2016 - Shit Happens
WoMakersCode 2016 -  Shit HappensWoMakersCode 2016 -  Shit Happens
WoMakersCode 2016 - Shit Happens
 
So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016So You Just Inherited a $Legacy Application… NomadPHP July 2016
So You Just Inherited a $Legacy Application… NomadPHP July 2016
 
So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...So You Just Inherited a $Legacy Application...
So You Just Inherited a $Legacy Application...
 
Agile Mumbai 2019 Conference | Intelligent DevOps enabling Enterprise Agilit...
Agile Mumbai 2019 Conference |  Intelligent DevOps enabling Enterprise Agilit...Agile Mumbai 2019 Conference |  Intelligent DevOps enabling Enterprise Agilit...
Agile Mumbai 2019 Conference | Intelligent DevOps enabling Enterprise Agilit...
 
Webinar-DevOps.pdf
Webinar-DevOps.pdfWebinar-DevOps.pdf
Webinar-DevOps.pdf
 
DOES SFO 2016 - Scott Willson - Top 10 Ways to Fail at DevOps
DOES SFO 2016 - Scott Willson - Top 10 Ways to Fail at DevOpsDOES SFO 2016 - Scott Willson - Top 10 Ways to Fail at DevOps
DOES SFO 2016 - Scott Willson - Top 10 Ways to Fail at DevOps
 
Web Development in Django
Web Development in DjangoWeb Development in Django
Web Development in Django
 
API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards 25-6-2014API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards 25-6-2014
 
API Athens Meetup - API standards 25-6-2014
API Athens Meetup - API standards   25-6-2014API Athens Meetup - API standards   25-6-2014
API Athens Meetup - API standards 25-6-2014
 
Open source-secret-sauce-rit-2010
Open source-secret-sauce-rit-2010Open source-secret-sauce-rit-2010
Open source-secret-sauce-rit-2010
 
2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently
 
DevOps Culture at Amazon
DevOps Culture at AmazonDevOps Culture at Amazon
DevOps Culture at Amazon
 
Advances in SAFe DevOps
Advances in SAFe DevOpsAdvances in SAFe DevOps
Advances in SAFe DevOps
 
Life of a Code Change to a Tier 1 Service - AWS Online Tech Talks
Life of a Code Change to a Tier 1 Service - AWS Online Tech TalksLife of a Code Change to a Tier 1 Service - AWS Online Tech Talks
Life of a Code Change to a Tier 1 Service - AWS Online Tech Talks
 
From Monolith to Microservices (And All the Bumps along the Way) (CON360-R1) ...
From Monolith to Microservices (And All the Bumps along the Way) (CON360-R1) ...From Monolith to Microservices (And All the Bumps along the Way) (CON360-R1) ...
From Monolith to Microservices (And All the Bumps along the Way) (CON360-R1) ...
 
Rapidly Building and Deploying Scalable Web Architectures
Rapidly Building and Deploying Scalable Web ArchitecturesRapidly Building and Deploying Scalable Web Architectures
Rapidly Building and Deploying Scalable Web Architectures
 
Test Masters 2016 Spring Conference
Test Masters 2016 Spring ConferenceTest Masters 2016 Spring Conference
Test Masters 2016 Spring Conference
 
Rapid software testing and conformance with static code analysis
Rapid software testing and conformance with static code analysisRapid software testing and conformance with static code analysis
Rapid software testing and conformance with static code analysis
 

Mais de Naresh Jain

Organizational Resilience
Organizational ResilienceOrganizational Resilience
Organizational Resilience
Naresh Jain
 
Improving the Quality of Incoming Code
Improving the Quality of Incoming CodeImproving the Quality of Incoming Code
Improving the Quality of Incoming Code
Naresh Jain
 
Agile India 2018 Conference
Agile India 2018 ConferenceAgile India 2018 Conference
Agile India 2018 Conference
Naresh Jain
 
MVP Design Hacks
MVP Design HacksMVP Design Hacks
MVP Design Hacks
Naresh Jain
 

Mais de Naresh Jain (20)

Problem Solving Techniques For Evolutionary Design
Problem Solving Techniques For Evolutionary DesignProblem Solving Techniques For Evolutionary Design
Problem Solving Techniques For Evolutionary Design
 
Agile India 2019 Conference Welcome Note
Agile India 2019 Conference Welcome NoteAgile India 2019 Conference Welcome Note
Agile India 2019 Conference Welcome Note
 
Organizational Resilience
Organizational ResilienceOrganizational Resilience
Organizational Resilience
 
Improving the Quality of Incoming Code
Improving the Quality of Incoming CodeImproving the Quality of Incoming Code
Improving the Quality of Incoming Code
 
Agile India 2018 Conference Summary
Agile India 2018 Conference SummaryAgile India 2018 Conference Summary
Agile India 2018 Conference Summary
 
Agile India 2018 Conference
Agile India 2018 ConferenceAgile India 2018 Conference
Agile India 2018 Conference
 
Agile India 2018 Conference
Agile India 2018 ConferenceAgile India 2018 Conference
Agile India 2018 Conference
 
Agile India 2018 Conference
Agile India 2018 ConferenceAgile India 2018 Conference
Agile India 2018 Conference
 
Pilgrim's Progress to the Promised Land by Robert Virding
Pilgrim's Progress to the Promised Land by Robert VirdingPilgrim's Progress to the Promised Land by Robert Virding
Pilgrim's Progress to the Promised Land by Robert Virding
 
Concurrent languages are Functional by Francesco Cesarini
Concurrent languages are Functional by Francesco CesariniConcurrent languages are Functional by Francesco Cesarini
Concurrent languages are Functional by Francesco Cesarini
 
Erlang from behing the trenches by Francesco Cesarini
Erlang from behing the trenches by Francesco CesariniErlang from behing the trenches by Francesco Cesarini
Erlang from behing the trenches by Francesco Cesarini
 
Anatomy of an eCommerce Search Engine by Mayur Datar
Anatomy of an eCommerce Search Engine by Mayur DatarAnatomy of an eCommerce Search Engine by Mayur Datar
Anatomy of an eCommerce Search Engine by Mayur Datar
 
Setting up Continuous Delivery Culture for a Large Scale Mobile App
Setting up Continuous Delivery Culture for a Large Scale Mobile AppSetting up Continuous Delivery Culture for a Large Scale Mobile App
Setting up Continuous Delivery Culture for a Large Scale Mobile App
 
Towards FutureOps: Stable, Repeatable environments from Dev to Prod
Towards FutureOps: Stable, Repeatable environments from Dev to ProdTowards FutureOps: Stable, Repeatable environments from Dev to Prod
Towards FutureOps: Stable, Repeatable environments from Dev to Prod
 
Value Driven Development by Dave Thomas
Value Driven Development by Dave Thomas Value Driven Development by Dave Thomas
Value Driven Development by Dave Thomas
 
No Silver Bullets in Functional Programming by Brian McKenna
No Silver Bullets in Functional Programming by Brian McKennaNo Silver Bullets in Functional Programming by Brian McKenna
No Silver Bullets in Functional Programming by Brian McKenna
 
Functional Programming Conference 2016
Functional Programming Conference 2016Functional Programming Conference 2016
Functional Programming Conference 2016
 
Agile India 2017 Conference
Agile India 2017 ConferenceAgile India 2017 Conference
Agile India 2017 Conference
 
Getting2Alpha: Turbo-charge your product with Game Thinking by Amy Jo Kim
Getting2Alpha: Turbo-charge your product with Game Thinking by Amy Jo KimGetting2Alpha: Turbo-charge your product with Game Thinking by Amy Jo Kim
Getting2Alpha: Turbo-charge your product with Game Thinking by Amy Jo Kim
 
MVP Design Hacks
MVP Design HacksMVP Design Hacks
MVP Design Hacks
 

Último

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+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
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Último (20)

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
%+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...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
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...
 
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
 
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 Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
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...
 
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
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
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...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 

Unleashing the Power of Automated Refactoring with JDT

  • 1. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Unleashing the Power of Automated Refactoring with JDT Law of Diversity Distrust all claims of ONE true way! Naresh Jain @nashjain http://nareshjain.com naresh@agilefaqs.com
  • 2. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Plan What and Why... Refactor? Automated Refactoring Demo 1 with JDT When and How... Refactor? Automated Refactoring Demo 2 with JDT
  • 3. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What is Refactoring?
  • 4. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What is Refactoring? A series of small steps, each of which changes the program’s internal structure without changing its external behaviour - Martin Fowler
  • 5. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear...
  • 6. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging
  • 7. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging
  • 8. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging Can you refactor the code so that it authenticates against LDAP instead of Database?
  • 9. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging Can you refactor the code so that it authenticates against LDAP instead of Database?
  • 10. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging Can you refactor the code so that it authenticates against LDAP instead of Database? We have too much duplicate code, we need to refactor the code to eliminate duplication
  • 11. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging Can you refactor the code so that it authenticates against LDAP instead of Database? We have too much duplicate code, we need to refactor the code to eliminate duplication
  • 12. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging Can you refactor the code so that it authenticates against LDAP instead of Database? We have too much duplicate code, we need to refactor the code to eliminate duplication This class is too big, we need to refactor it
  • 13. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging Can you refactor the code so that it authenticates against LDAP instead of Database? We have too much duplicate code, we need to refactor the code to eliminate duplication This class is too big, we need to refactor it
  • 14. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging Can you refactor the code so that it authenticates against LDAP instead of Database? We have too much duplicate code, we need to refactor the code to eliminate duplication This class is too big, we need to refactor it In-Memory Object Caching?
  • 15. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. What if you hear... We’ll just refactor the code to support logging Can you refactor the code so that it authenticates against LDAP instead of Database? We have too much duplicate code, we need to refactor the code to eliminate duplication This class is too big, we need to refactor it In-Memory Object Caching?
  • 16. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Origin Ward Cunningham and Kent Beck Smalltalk style Ralph Johnson at University of Illinois at Urbana- Champaign Bill Opdyke’s Thesis ftp://st.cs.uiuc.edu/pub/papers/refactoring/opdyke- thesis.ps.Z John Brant and Don Roberts:The Refactoring Browser
  • 17. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Readability Which code segment is easier to read? Sample 1 if (date.Before(Summer_Start) || date.After(Summer_End)){ charge = quantity * winterRate + winterServiceCharge; else charge = quantity * summerRate; } Sample 2 if (IsSummer(date)) { charge = SummerCharge(quantity); else charge = WinterCharge(quantity); }
  • 21.
  • 22.
  • 23.
  • 25.
  • 26.
  • 27. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Automated Refactoring Demo 1
  • 28. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. How do we Refactor? We looks for Code-Smells Things that we suspect are not quite right or will cause us severe pain if we do not fix
  • 29. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. 2 Piece of Advice before Refactoring
  • 30. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. 2 Piece of Advice before Refactoring Baby Steps
  • 31. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. 2 Piece of Advice before Refactoring Baby Steps The Hippocratic Oath First Do No Harm!
  • 32. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Automated Refactoring Demo 2
  • 33.
  • 34. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Code Smells Lab Long Method Lazy class and Speculative Generality Smell Refused Bequest Black Sheep Duplicate Code Switch Smell Dead Code Alternative Classes with different interface Odd Ball solution Primitive Obsession
  • 35. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor?
  • 36. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor? Helps us deliver more business value faster
  • 37. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor? Helps us deliver more business value faster Improves the design of our software Combat’s “bit rot” Easier to maintain and understand Easier to facilitate change More flexibility Increased re-usability
  • 38. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor?...
  • 39. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor?... Minimizes technical debt
  • 40. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor?... Minimizes technical debt Keep development at speed
  • 41. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor?... Minimizes technical debt Keep development at speed To make the software easier to understand Write for people, not the compiler Understand unfamiliar code
  • 42. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor?... Minimizes technical debt Keep development at speed To make the software easier to understand Write for people, not the compiler Understand unfamiliar code To help find bugs refactor while debugging to clarify the code
  • 43. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Why do we Refactor?... Minimizes technical debt Keep development at speed To make the software easier to understand Write for people, not the compiler Understand unfamiliar code To help find bugs refactor while debugging to clarify the code To “Fix broken windows” - Pragmatic Programmers
  • 44. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. When should you refactor?
  • 45. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. When should you refactor? To add new functionality refactor existing code until you understand it refactor the design to make it simple to add
  • 46. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. When should you refactor? To add new functionality refactor existing code until you understand it refactor the design to make it simple to add To find bugs refactor to understand the code
  • 47. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. When should you refactor? To add new functionality refactor existing code until you understand it refactor the design to make it simple to add To find bugs refactor to understand the code For code reviews immediate effect of code review allows for higher level suggestions
  • 48. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. When should you refactor? To add new functionality refactor existing code until you understand it refactor the design to make it simple to add To find bugs refactor to understand the code For code reviews immediate effect of code review allows for higher level suggestions Like championship snooker players we are setting ourselves up for our next shot
  • 49. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. The Two Hats Adding Function Add new capabilities to the system Adds new tests Get the test working Refactoring Does not add any new features Does not add tests (but may change some) Restructure the code to remove redundancy
  • 50. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. The Two Hats Adding Function Add new capabilities to the system Adds new tests Get the test working Refactoring Does not add any new features Does not add tests (but may change some) Restructure the code to remove redundancy Swap frequently between the hats, but only wear one at a time
  • 51. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor
  • 52. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test
  • 53. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test
  • 54. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Pass
  • 55. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Fail Pass
  • 56. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Make a little change Fail Pass
  • 57. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Make a little change Run the Test Fail Pass
  • 58. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Make a little change Run the Test Fail Fail Pass
  • 59. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Make a little change Run the Test Fail Pass Fail Pass
  • 60. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Make a little change Run the Test Refactor Fail Pass Fail Pass
  • 61. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Make a little change Run the Test Refactor Fail Pass Fail Pass
  • 62. http://agilefaqs.com | Copyright © 2016, AgileFAQs. All Rights Reserved. Refactoring and TDD TDD Rhythm - Test, Code, Refactor Add a Test Run the Test Make a little change Run the Test Refactor Fail Pass Fail Pass
  • 63. T H A N K Y O U ! Q U E S T I O N S ? Naresh Jain @nashjain http://nareshjain.com