SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Plus 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
 

Plus 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
 

Dernier

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 

Dernier (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

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

Notes de l'éditeur

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