SlideShare una empresa de Scribd logo
1 de 39
Everything you Wanted to Know About Refactoring but were Afraid to Ask! By Gary Short Technical Evangelist Developer Express
Agenda What is Refactoring? Why Should I Refactor? How do I know that I have to refactor? How Should I Refactor? How can Tooling Help Me? Advanced Refactoring.
Why do I Need to Know this? Refactoring is a professional dev skill Therefore it’s a must have skill for you! Helps to keep technical debt under control Technical debt kills projects.
Introduction Gary Short Technical Evangelist for Developer Express Community Evangelist for... Well, me really!  Microsoft MVP C# Where do I hang out? http://www.garyshort.org (blog) http://www.twitter.com/garyshort http://www.sodthis.com (podcast).
How About you Guys?
What is Refactoring? Knowledge says refactoring is... the process of changing a computer program's internal structure  without modifying its external functional behavior  or existing functionality,  in order to improve  internal non-functional properties of the software,  for example to improve code readability,  to simplify code structure,  to change code to adhere to a given programming paradigm,  to improve maintainability,  or to improve extensibility.
Ooo, Hold on, How’d you do That? the process of changing a computer program's internal structure  without modifying its external functional behavior  or existing functionality,  Unit Testing is a software design and development method where the programmer gains confidence that individual units of source code are fit for use modern applications include the use of a test framework such as nUnit each test case is independent from the others: substitutes like method stubs, mock objects, fakes and test harnesses can be used to assist testing a module in isolation.
Quick Example Biggest Refactoring Eva!! ,[object Object]
The earthquake reminded the world that the San Francisco Bay region remains vulnerable
If a Richter magnitude 8.0 or greater earthquake centered near the Bridge, there would be a substantial risk of impending collapse
Retrofit starts 1997
Still ongoing today
Cost ~ half a billion dollars.,[object Object]
Financial Debt Isn’t All Bad
Technical Debt Isn’t all Bad Either
Refactoring Pays Back this Debt
Refactoring Pays Back this Debt
How Do I Know When To Refactor?
How Do I Know When To Refactor?
How Do I Know When To Refactor?
How Do I Know When To Refactor?
How Do I Know When To Refactor?
How Do I Know When To Refactor?
How Should I Refactor? Ask yourself the following questions Is my code readable?  Is my code abstract?  Anything more is rearranging the deck chairs on the Titanic It gives you a sense of doing something But ultimately it’s pointless. 
Refactoring for Readability #1
Refactoring for Readability #1
Refactoring for Readability #2
Refactoring for Readability #3
Refactoring for Readability #4
Refactoring for Readability #5
Refactoring to Make Abstract #1
Refactoring to Make Abstract #2
Refactoring to Make Abstract #2
Refactoring to Make Abstract #3
Can Tooling Help me? Yes, in the following ways Refactoring can be repetitive Repetitive tasks bore humans Resulting in mistakes Solutions can contain many projects Many classes with many projects can contain the same method calls This makes them hard to find and easy to miss Tools can suggest refactors that you might not know exist.
Tooling Demo
Refactoring to Patterns #1
Refactoring to Patterns #1
Refactoring to Patterns #2

Más contenido relacionado

Similar a Everything you Wanted to Know About Refactoring

Software and all that comes with it
Software and all that comes with itSoftware and all that comes with it
Software and all that comes with itAlberto Brandolini
 
From 🤦 to 🐿️
From 🤦 to 🐿️From 🤦 to 🐿️
From 🤦 to 🐿️Ori Pekelman
 
From DevOps to NoOps how not to get Equifaxed Apidays
From DevOps to NoOps how not to get Equifaxed ApidaysFrom DevOps to NoOps how not to get Equifaxed Apidays
From DevOps to NoOps how not to get Equifaxed ApidaysOri Pekelman
 
Technical Debt for Product Managers by Square Sr PM
Technical Debt for Product Managers by Square Sr PMTechnical Debt for Product Managers by Square Sr PM
Technical Debt for Product Managers by Square Sr PMProduct School
 
How to justify technical debt mitigations in Software Engineering
How to justify technical debt mitigations in Software EngineeringHow to justify technical debt mitigations in Software Engineering
How to justify technical debt mitigations in Software EngineeringAndré Agostinho
 
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...Juraj Martinka
 
Refactoring 2TheMax (con ReSharper)
Refactoring 2TheMax (con ReSharper)Refactoring 2TheMax (con ReSharper)
Refactoring 2TheMax (con ReSharper)DotNetMarche
 
Agile Australia 2016 - Rescuing Legacy Software from Impending Doom
Agile Australia 2016 - Rescuing Legacy Software from Impending DoomAgile Australia 2016 - Rescuing Legacy Software from Impending Doom
Agile Australia 2016 - Rescuing Legacy Software from Impending DoomJacques De Vos
 
Refactoring, 2nd Edition
Refactoring, 2nd EditionRefactoring, 2nd Edition
Refactoring, 2nd Editionjexp
 
2018 01-29 - brewbox - refactoring. sempre, senza pietà
2018 01-29 - brewbox - refactoring. sempre, senza pietà2018 01-29 - brewbox - refactoring. sempre, senza pietà
2018 01-29 - brewbox - refactoring. sempre, senza pietàRoberto Albertini
 
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...Burr Sutter
 
How to deal with tech debt: Lessons learned from the best engineering teams
How to deal with tech debt: Lessons learned from the best engineering teamsHow to deal with tech debt: Lessons learned from the best engineering teams
How to deal with tech debt: Lessons learned from the best engineering teamsAlexandre Omeyer
 
Technical Debt - osbridge
Technical Debt - osbridgeTechnical Debt - osbridge
Technical Debt - osbridgeenaramore
 
Sandro Mancuso and David Green: London Software Craftsmanship Community: What...
Sandro Mancuso and David Green: London Software Craftsmanship Community: What...Sandro Mancuso and David Green: London Software Craftsmanship Community: What...
Sandro Mancuso and David Green: London Software Craftsmanship Community: What...Skills Matter
 
Agile Development Overview (with a bit about builds)
Agile Development Overview (with a bit about builds)Agile Development Overview (with a bit about builds)
Agile Development Overview (with a bit about builds)David Benjamin
 
TPS Lean and Agile - Brief History and Future
TPS Lean and Agile - Brief History and FutureTPS Lean and Agile - Brief History and Future
TPS Lean and Agile - Brief History and FutureKiro Harada
 
Improving the Usability of Refactoring Tools for Software Change Tasks
Improving the Usability of Refactoring Tools for Software Change TasksImproving the Usability of Refactoring Tools for Software Change Tasks
Improving the Usability of Refactoring Tools for Software Change TasksAnna Maria Eilertsen
 

Similar a Everything you Wanted to Know About Refactoring (20)

Software and all that comes with it
Software and all that comes with itSoftware and all that comes with it
Software and all that comes with it
 
From 🤦 to 🐿️
From 🤦 to 🐿️From 🤦 to 🐿️
From 🤦 to 🐿️
 
From DevOps to NoOps how not to get Equifaxed Apidays
From DevOps to NoOps how not to get Equifaxed ApidaysFrom DevOps to NoOps how not to get Equifaxed Apidays
From DevOps to NoOps how not to get Equifaxed Apidays
 
Technical Debt for Product Managers by Square Sr PM
Technical Debt for Product Managers by Square Sr PMTechnical Debt for Product Managers by Square Sr PM
Technical Debt for Product Managers by Square Sr PM
 
How to justify technical debt mitigations in Software Engineering
How to justify technical debt mitigations in Software EngineeringHow to justify technical debt mitigations in Software Engineering
How to justify technical debt mitigations in Software Engineering
 
Refactoring 2 The Max
Refactoring 2 The MaxRefactoring 2 The Max
Refactoring 2 The Max
 
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
 
Refactoring 2TheMax (con ReSharper)
Refactoring 2TheMax (con ReSharper)Refactoring 2TheMax (con ReSharper)
Refactoring 2TheMax (con ReSharper)
 
Agile Australia 2016 - Rescuing Legacy Software from Impending Doom
Agile Australia 2016 - Rescuing Legacy Software from Impending DoomAgile Australia 2016 - Rescuing Legacy Software from Impending Doom
Agile Australia 2016 - Rescuing Legacy Software from Impending Doom
 
Technical debt
Technical debtTechnical debt
Technical debt
 
Refactoring, 2nd Edition
Refactoring, 2nd EditionRefactoring, 2nd Edition
Refactoring, 2nd Edition
 
2018 01-29 - brewbox - refactoring. sempre, senza pietà
2018 01-29 - brewbox - refactoring. sempre, senza pietà2018 01-29 - brewbox - refactoring. sempre, senza pietà
2018 01-29 - brewbox - refactoring. sempre, senza pietà
 
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
Teaching Elephants to Dance (and Fly!): A Developer's Journey to Digital Tran...
 
How to deal with tech debt: Lessons learned from the best engineering teams
How to deal with tech debt: Lessons learned from the best engineering teamsHow to deal with tech debt: Lessons learned from the best engineering teams
How to deal with tech debt: Lessons learned from the best engineering teams
 
Technical Debt - osbridge
Technical Debt - osbridgeTechnical Debt - osbridge
Technical Debt - osbridge
 
Sandro Mancuso and David Green: London Software Craftsmanship Community: What...
Sandro Mancuso and David Green: London Software Craftsmanship Community: What...Sandro Mancuso and David Green: London Software Craftsmanship Community: What...
Sandro Mancuso and David Green: London Software Craftsmanship Community: What...
 
Agile Development Overview (with a bit about builds)
Agile Development Overview (with a bit about builds)Agile Development Overview (with a bit about builds)
Agile Development Overview (with a bit about builds)
 
TPS Lean and Agile - Brief History and Future
TPS Lean and Agile - Brief History and FutureTPS Lean and Agile - Brief History and Future
TPS Lean and Agile - Brief History and Future
 
Improving the Usability of Refactoring Tools for Software Change Tasks
Improving the Usability of Refactoring Tools for Software Change TasksImproving the Usability of Refactoring Tools for Software Change Tasks
Improving the Usability of Refactoring Tools for Software Change Tasks
 
Technical Debt
Technical DebtTechnical Debt
Technical Debt
 

Más de Gary Short

Raspberry Pi - Rocksolid Tour 2013
Raspberry Pi  - Rocksolid Tour 2013Raspberry Pi  - Rocksolid Tour 2013
Raspberry Pi - Rocksolid Tour 2013Gary Short
 
Not Everything is an Object - Rocksolid Tour 2013
Not Everything is an Object  - Rocksolid Tour 2013Not Everything is an Object  - Rocksolid Tour 2013
Not Everything is an Object - Rocksolid Tour 2013Gary Short
 
Marginal Gains - Rocksolid Tour 2013
Marginal Gains  - Rocksolid Tour 2013Marginal Gains  - Rocksolid Tour 2013
Marginal Gains - Rocksolid Tour 2013Gary Short
 
.Net Collection Classes Deep Dive - Rocksolid Tour 2013
.Net Collection Classes Deep Dive  - Rocksolid Tour 2013.Net Collection Classes Deep Dive  - Rocksolid Tour 2013
.Net Collection Classes Deep Dive - Rocksolid Tour 2013Gary Short
 
Building an Internet Radio on the RaspberryPI
Building an Internet Radio on the RaspberryPIBuilding an Internet Radio on the RaspberryPI
Building an Internet Radio on the RaspberryPIGary Short
 
Not Everything Is An Object
Not Everything Is An ObjectNot Everything Is An Object
Not Everything Is An ObjectGary Short
 
Technical Debt
Technical DebtTechnical Debt
Technical DebtGary Short
 

Más de Gary Short (7)

Raspberry Pi - Rocksolid Tour 2013
Raspberry Pi  - Rocksolid Tour 2013Raspberry Pi  - Rocksolid Tour 2013
Raspberry Pi - Rocksolid Tour 2013
 
Not Everything is an Object - Rocksolid Tour 2013
Not Everything is an Object  - Rocksolid Tour 2013Not Everything is an Object  - Rocksolid Tour 2013
Not Everything is an Object - Rocksolid Tour 2013
 
Marginal Gains - Rocksolid Tour 2013
Marginal Gains  - Rocksolid Tour 2013Marginal Gains  - Rocksolid Tour 2013
Marginal Gains - Rocksolid Tour 2013
 
.Net Collection Classes Deep Dive - Rocksolid Tour 2013
.Net Collection Classes Deep Dive  - Rocksolid Tour 2013.Net Collection Classes Deep Dive  - Rocksolid Tour 2013
.Net Collection Classes Deep Dive - Rocksolid Tour 2013
 
Building an Internet Radio on the RaspberryPI
Building an Internet Radio on the RaspberryPIBuilding an Internet Radio on the RaspberryPI
Building an Internet Radio on the RaspberryPI
 
Not Everything Is An Object
Not Everything Is An ObjectNot Everything Is An Object
Not Everything Is An Object
 
Technical Debt
Technical DebtTechnical Debt
Technical Debt
 

Último

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Everything you Wanted to Know About Refactoring

  • 1. Everything you Wanted to Know About Refactoring but were Afraid to Ask! By Gary Short Technical Evangelist Developer Express
  • 2. Agenda What is Refactoring? Why Should I Refactor? How do I know that I have to refactor? How Should I Refactor? How can Tooling Help Me? Advanced Refactoring.
  • 3. Why do I Need to Know this? Refactoring is a professional dev skill Therefore it’s a must have skill for you! Helps to keep technical debt under control Technical debt kills projects.
  • 4. Introduction Gary Short Technical Evangelist for Developer Express Community Evangelist for... Well, me really!  Microsoft MVP C# Where do I hang out? http://www.garyshort.org (blog) http://www.twitter.com/garyshort http://www.sodthis.com (podcast).
  • 6. What is Refactoring? Knowledge says refactoring is... the process of changing a computer program's internal structure without modifying its external functional behavior or existing functionality, in order to improve internal non-functional properties of the software, for example to improve code readability, to simplify code structure, to change code to adhere to a given programming paradigm, to improve maintainability, or to improve extensibility.
  • 7. Ooo, Hold on, How’d you do That? the process of changing a computer program's internal structure without modifying its external functional behavior or existing functionality, Unit Testing is a software design and development method where the programmer gains confidence that individual units of source code are fit for use modern applications include the use of a test framework such as nUnit each test case is independent from the others: substitutes like method stubs, mock objects, fakes and test harnesses can be used to assist testing a module in isolation.
  • 8.
  • 9. The earthquake reminded the world that the San Francisco Bay region remains vulnerable
  • 10. If a Richter magnitude 8.0 or greater earthquake centered near the Bridge, there would be a substantial risk of impending collapse
  • 13.
  • 15. Technical Debt Isn’t all Bad Either
  • 18. How Do I Know When To Refactor?
  • 19. How Do I Know When To Refactor?
  • 20. How Do I Know When To Refactor?
  • 21. How Do I Know When To Refactor?
  • 22. How Do I Know When To Refactor?
  • 23. How Do I Know When To Refactor?
  • 24. How Should I Refactor? Ask yourself the following questions Is my code readable? Is my code abstract? Anything more is rearranging the deck chairs on the Titanic It gives you a sense of doing something But ultimately it’s pointless. 
  • 31. Refactoring to Make Abstract #1
  • 32. Refactoring to Make Abstract #2
  • 33. Refactoring to Make Abstract #2
  • 34. Refactoring to Make Abstract #3
  • 35. Can Tooling Help me? Yes, in the following ways Refactoring can be repetitive Repetitive tasks bore humans Resulting in mistakes Solutions can contain many projects Many classes with many projects can contain the same method calls This makes them hard to find and easy to miss Tools can suggest refactors that you might not know exist.
  • 41. Summary Refactoring is changing the structure, but not the functionality of your application Refactoring is done to pay back the “Technical Debt” Refactor by asking is your code Readable Abstract Invest in some tooling.
  • 42. Further Reading Fowler, Martin (1999). Refactoring. Improving the Design of Existing Code. Addison-Wesley. ISBN 0-201-48567-2.  Wake, William C. (2003). Refactoring Workbook. Addison-Wesley. ISBN 0-321-10929-5.  Feathers, Michael C (2004). Working Effectively with Legacy Code. Prentice Hall. ISBN 0-13-117705-2.  Kerievsky, Joshua (2004). Refactoring To Patterns. Addison-Wesley. ISBN 0-321-21335-1.  Arsenovski, Danijel (2008). Professional Refactoring in Visual Basic. Wrox. ISBN 0-47-017979-1. 
  • 43. Questions http://www.garyshort.org http://www.twitter.com/garyshort http://www.sodthis.com gary@garyshort.org

Notas del editor

  1. Constructor Chaining
  2. Compose Method
  3. If / case statement to polymorphism