SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Code Refactoring
Lalit Kale
LalitKale@gmail.com
Preface
• Audience:
• Beginner and intermediate level of developers, technical leads and software architects
• interested in software design and development
• having trouble in understanding and Implementing software design Principles and Patterns
• People who are keen on improving their craft
• Presentation:
• Approx. Time: 1 Hour
• Discussion Over Monotonous Delivery
• Planned slides for Questions are marked with Question Icon, Feel free to jump in to express your thoughts
• Code Snippets to understand the concepts – Not Ready for Production
• All Views/Opinions expressed here are mine and nothing to do with my current/past employers
2
About Me
• Working on .NET from last 11 years
• Journey: Software Developer  Sr. Developer  Tech Lead  Architect
• Startup To Large Enterprise
• Hands on experience (Code daily for living)
• Interested in software architecture of High-Volume High Traffic distributed Systems
• Beginner in Python and Machine Learning
3
4
Source of Inspiration
Martin Fowler
Overview
• What is Refactoring?
• Why Refactoring?
• Refactoring Myths
• What To Refactor?
• Workflows Of Refactoring
• Refactoring Principles
• Refactoring Tools
• Refactoring Techniques
• Refactoring Thumbnails
• Summary
5
What is Refactoring?
6
What is Refactoring?
• Wikipedia
Refactoring is a redrafting process in which talk page content is moved, removed, revised,
restructured, hidden, or otherwise changed. It applies only in contexts where editors make
signed statements (such as talk and user namespaces),and has a number of uses, including:
7
• Improving the clarity and readability of a page
• Removal of off-topic, uncivil, unclear, or otherwise distracting material
• Restructuring of discussions for clarity
• Relocation of material to different sections or pages where it is more appropriate
What is Refactoring?
• Ward Cunningham
“Amelioration Pattern: The act of relieving ills and changing for the
better”
• ills = Software Rot factors
• Rigidity
• Fragility
• Needless complexity
• Toxicity
8
What is Code Refactoring?
• Martin Fowler
• "Refactoring is the process of changing a software system in such a way that it does not alter the
external behavior of the code yet improves its internal structure."
- Refactoring, The design of existing Code, Martin Fowler, 1999
• “Refactoring is a disciplined technique for restructuring an existing body of code, altering its
internal structure without changing its external behavior.
– Refactoring.com, Martin Fowler 2016
9
What is Code Refactoring?
“Refactoring is a disciplined technique for restructuring an existing body of
code, altering its internal structure without changing its external behavior.”
10
What is Code Refactoring?
Its heart is a series of small behavior preserving transformations. Each
transformation (called a “refactoring”) does little, but a sequence of
transformations can produce a significant restructuring. Since each
refactoring is small, it’s less likely to go wrong. The system is kept fully
working after each small refactoring, reducing the chances that a system can
get seriously broken during the restructuring.
11
Why Refactor?
12
13
Why Refactor?
“Programs must be written for people to read, and only incidentally for machines to
execute”—Abelson and Sussman
Why Refactor?
14
Green
Refactor
Red
Refactoring Makes code adaptable to change
Write a Failing Test Do All sins to Pass the Failing Test
– Kent Beck
Pay for all sins and clean up code
Why Refactor?
• Keep code focused
• Improving the clarity and readability of code
• Removal of unclear, or otherwise distracting boilerplates and code segments
• Restructuring for clarity
• Helps to pay timely technical debt
• Leads to lightweight pragmatic design
• Avoids code rot
15
Zen says “To move faster, you need to do it right”
Refactoring Myths
17
Refactoring Myths
• “If It isn’t Broken, Don't Fix It”
• So We do not need refactoring
• Then,
• You add more features
• You enhance existing features
• Better infrastructure emerge
• Your competition change
• Which Results in changing your application/system
• Fact: Change is one of the strongest force in software development
18
Refactoring Myths and Misunderstandings
• Symptoms
• “Refactoring Takes Time”
• “We need to plan for separate refactoring time “
• “This entire project needs refactoring”
• “Refactoring this project will need at least X Weeks/months”
• Underlying Myth: Refactoring is one time activity/Task
• Fact: Refactoring is continual Activity
19
Refactoring Myths and Misunderstandings
• Refactoring is Re-work
• Fact: Refactoring gives opportunity to fix inefficiencies in system
• For Refactoring, we need special tools
• Fact: Tools are important but not mandatory. Refactoring Mindset is mandatory
• Refactoring can replace Code Reviews
• Fact: Objective of Code reviews are quite different than those of refactoring.
So, you can not compare apples with oranges.
20
21
Refactoring Myths
Refactoring ≠ Re-Engineering
What To Refactor?
• In general
• Code written to satisfy the feature
• Unit Tests
• But Can be
• Database Queries and Schema
• Assembly/Package Arrangements
• Configurations
• API Endpoints
• Integration Tests
22
Workflows of Refactoring
23
24
Workflows of Refactoring
Refactoring Principles
• DRY – Do not Repeat Yourself
“Every piece of knowledge must have a single, unambiguous, authoritative
representation within a system” – Pragmatic Programmers
• If nothing else, duplication is the single most enemy you can pick up in
refactoring stage
25
Refactoring Principles
• KISS: Keep It Simple Stupid!
• Avoid Clever code. Write Clear Code.
26
Refactoring Principles
• YAGNI – You Ain’t Gonna Need It!
• Boy-Scout Rule
• SOLID Principles
• Greatly Helpful Practice: Pair Programming
27
Refactoring Tools
• For .NET
• Visual Studio IDE
• Resharper by JetBrains
• CodeRush by DevExpress
• JustCode by Telerik
28
• For Java
• Eclipse IDE
• IntelliJ
• JRefactory
Refactoring Techniques
29
Refactoring Techniques
• Abstraction Focused
• Encapsulate Field – force code to access the field with getter and setter methods
• Generalize Type – create more general types to allow for more code sharing
• Replace type-checking code with State/Strategy
• Replace conditional with polymorphism
30
Refactoring Techniques
• Isolation Focused
• Extract Class – moves part of the code from an existing class into a new class.
• Extract Method – to turn part of a larger method into a new method. By breaking down code
in smaller pieces, it is more easily understandable. This is also applicable to functions.
31
Refactoring Techniques
• Code Clarity Focused
• Move Method or Move Field – move to a more appropriate Class or source file
• Rename Method or Rename Field – changing the name into a new one that better reveals its
purpose
• Pull Up – move to a superclass
• Push Down – move to a subclass
32
Refactoring Techniques
• Refactoring Catalog
• http://refactoring.com/catalog/
• Problem Solution Summary of well-
known refactorings
• Maintained by Martin Fowler
33
34
Refactoring Thumbnails
Refactoring catalog is overwhelming…How I can remember everything?
You don’t need to…
Use Refactoring Thumbnails by Sven Gorts
Refactoring Thumbnails
• Clear, Pragmatic design will only emerge, If team members share a common understanding
• Common Understanding requires clear and unambiguous communication
• Should be quick and simple enough to iterate
• Without making actual code changes
Refactoring Thumbnails is the visual technique which satisfies all these
requirements
35
Refactoring Thumbnails
• Express the evolution of a design over period of time
• Sequence of high-level refactoring
• Present intermediate stages
36
Time
Refactoring Thumbnails - Example
• Start with : copy-paste code
• Evolve to : inheritance-based reuse
• Passing an : intermediate stage
• End with : interface-based solution
37
Time
38
Refactoring Thumbnails - Example
Move Feature Refactoring
39
Evolution Chart
Eliminate Duplication By Composition
Summary
• Refactoring is continuous activity and part of development workflow
• Re-Engineering != Refactoring
• Refactoring needs (unit+ Integration) tests to verify external behaviors.
• Refactoring Tools are extremely helpful but not mandatory
• Refactoring Techniques are better visualized with Refactoring Thumbnails and
Evolution Charts
40
Summary
Refactoring ➔ Clean Code ➔ Faster Delivery ➔ Happy Customers 
41
Resources
• https://en.wikipedia.org/wiki/Wikipedia:Refactoring_talk_pages
• http://www.refactoring.com
• www.Refactoring.be
• Book: Refactoring: Improving the Design of Existing Code
42
Thank You!
43
.
This presentation is shared under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license. More information for this license is available at http://creativecommons.org/licenses/by-nc-sa/4.0/
All trademarks are the property of their respective owners. Lalit Kale makes no warranties, express, implied or statutory, as to the information in this presentation.
Lalit Kale
lalitkale@gmail.com
http://lalitkale.wordpress.com

Weitere ähnliche Inhalte

Was ist angesagt?

Software Re-Engineering
Software Re-EngineeringSoftware Re-Engineering
Software Re-EngineeringSaqib Raza
 
The Single Responsibility Principle
The Single Responsibility PrincipleThe Single Responsibility Principle
The Single Responsibility PrincipleLars-Erik Kindblad
 
Software re engineering
Software re engineeringSoftware re engineering
Software re engineeringdeshpandeamrut
 
Code Smells and Its type (With Example)
Code Smells and Its type (With Example)Code Smells and Its type (With Example)
Code Smells and Its type (With Example)Anshul Vinayak
 
Bad Code Smells
Bad Code SmellsBad Code Smells
Bad Code Smellskim.mens
 
Test Driven Development With Python
Test Driven Development With PythonTest Driven Development With Python
Test Driven Development With PythonSiddhi
 
Fixing Dockerfile Smells: An Empirical Study (ICSME 2022)
Fixing Dockerfile Smells: An Empirical Study (ICSME 2022)Fixing Dockerfile Smells: An Empirical Study (ICSME 2022)
Fixing Dockerfile Smells: An Empirical Study (ICSME 2022)Giovanni Rosa
 
Maintenance & Re-Engineering of Software
Maintenance & Re-Engineering of SoftwareMaintenance & Re-Engineering of Software
Maintenance & Re-Engineering of SoftwareAdeel Riaz
 
Open Closed Principle kata
Open Closed Principle kataOpen Closed Principle kata
Open Closed Principle kataPaul Blundell
 
Dependency Inversion Principle
Dependency Inversion PrincipleDependency Inversion Principle
Dependency Inversion PrincipleShahriar Hyder
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version ControlJeremy Coates
 
Agile software development and extreme Programming
Agile software development and extreme Programming  Agile software development and extreme Programming
Agile software development and extreme Programming Fatemeh Karimi
 
50500113 spiral-model
50500113 spiral-model50500113 spiral-model
50500113 spiral-modelasidharath
 
LEGACY SYSTEM In Software Engineering By NADEEM AHMED
LEGACY SYSTEM In Software Engineering By NADEEM AHMED LEGACY SYSTEM In Software Engineering By NADEEM AHMED
LEGACY SYSTEM In Software Engineering By NADEEM AHMED NA000000
 

Was ist angesagt? (20)

Refactoring
RefactoringRefactoring
Refactoring
 
Software Re-Engineering
Software Re-EngineeringSoftware Re-Engineering
Software Re-Engineering
 
The Single Responsibility Principle
The Single Responsibility PrincipleThe Single Responsibility Principle
The Single Responsibility Principle
 
Refactoring
RefactoringRefactoring
Refactoring
 
Software re engineering
Software re engineeringSoftware re engineering
Software re engineering
 
Code Smells and Its type (With Example)
Code Smells and Its type (With Example)Code Smells and Its type (With Example)
Code Smells and Its type (With Example)
 
Bad Code Smells
Bad Code SmellsBad Code Smells
Bad Code Smells
 
Test Driven Development With Python
Test Driven Development With PythonTest Driven Development With Python
Test Driven Development With Python
 
Fixing Dockerfile Smells: An Empirical Study (ICSME 2022)
Fixing Dockerfile Smells: An Empirical Study (ICSME 2022)Fixing Dockerfile Smells: An Empirical Study (ICSME 2022)
Fixing Dockerfile Smells: An Empirical Study (ICSME 2022)
 
Chapter 03 python libraries
Chapter 03 python librariesChapter 03 python libraries
Chapter 03 python libraries
 
Maintenance & Re-Engineering of Software
Maintenance & Re-Engineering of SoftwareMaintenance & Re-Engineering of Software
Maintenance & Re-Engineering of Software
 
Software reengineering
Software reengineeringSoftware reengineering
Software reengineering
 
Open Closed Principle kata
Open Closed Principle kataOpen Closed Principle kata
Open Closed Principle kata
 
Dependency Inversion Principle
Dependency Inversion PrincipleDependency Inversion Principle
Dependency Inversion Principle
 
Introduction to Version Control
Introduction to Version ControlIntroduction to Version Control
Introduction to Version Control
 
Design pattern-presentation
Design pattern-presentationDesign pattern-presentation
Design pattern-presentation
 
Agile software development and extreme Programming
Agile software development and extreme Programming  Agile software development and extreme Programming
Agile software development and extreme Programming
 
Chap3 RE elicitation
Chap3 RE elicitationChap3 RE elicitation
Chap3 RE elicitation
 
50500113 spiral-model
50500113 spiral-model50500113 spiral-model
50500113 spiral-model
 
LEGACY SYSTEM In Software Engineering By NADEEM AHMED
LEGACY SYSTEM In Software Engineering By NADEEM AHMED LEGACY SYSTEM In Software Engineering By NADEEM AHMED
LEGACY SYSTEM In Software Engineering By NADEEM AHMED
 

Andere mochten auch

Code Refactoring
Code RefactoringCode Refactoring
Code RefactoringYu-Chih Lin
 
Multicore Explosion and its impact in application software development (Year ...
Multicore Explosion and its impact in application software development (Year ...Multicore Explosion and its impact in application software development (Year ...
Multicore Explosion and its impact in application software development (Year ...Vasu Thiyagarajan
 
Refactoring code smell
Refactoring code smellRefactoring code smell
Refactoring code smellmartintsch
 
Refaktoryzacja kodu w języku PHP
Refaktoryzacja kodu w języku PHPRefaktoryzacja kodu w języku PHP
Refaktoryzacja kodu w języku PHPDevCastZone
 
FLTK Summer Course - Part III - Third Impact
FLTK Summer Course - Part III - Third ImpactFLTK Summer Course - Part III - Third Impact
FLTK Summer Course - Part III - Third ImpactMichel Alves
 
TMS - Schedule of Presentations and Reports
TMS - Schedule of Presentations and ReportsTMS - Schedule of Presentations and Reports
TMS - Schedule of Presentations and ReportsMichel Alves
 
Using Git on the Command Line
Using Git on the Command LineUsing Git on the Command Line
Using Git on the Command LineBrian Richards
 
FLTK Summer Course - Part I - First Impact - Exercises
FLTK Summer Course - Part I - First Impact - ExercisesFLTK Summer Course - Part I - First Impact - Exercises
FLTK Summer Course - Part I - First Impact - ExercisesMichel Alves
 
Servicios web con Python
Servicios web con PythonServicios web con Python
Servicios web con PythonManuel Pérez
 
Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Anil Sagar
 
FLTK Summer Course - Part VI - Sixth Impact - Exercises
FLTK Summer Course - Part VI - Sixth Impact - ExercisesFLTK Summer Course - Part VI - Sixth Impact - Exercises
FLTK Summer Course - Part VI - Sixth Impact - ExercisesMichel Alves
 
Manipulating file in Python
Manipulating file in PythonManipulating file in Python
Manipulating file in Pythonshoukatali500
 
"Git Hooked!" Using Git hooks to improve your software development process
"Git Hooked!" Using Git hooks to improve your software development process"Git Hooked!" Using Git hooks to improve your software development process
"Git Hooked!" Using Git hooks to improve your software development processPolished Geek LLC
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsCarl Brown
 
Git hooks For PHP Developers
Git hooks For PHP DevelopersGit hooks For PHP Developers
Git hooks For PHP DevelopersUmut IŞIK
 
FLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second ImpactFLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second ImpactMichel Alves
 
FLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part VIII - Eighth ImpactFLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part VIII - Eighth ImpactMichel Alves
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Peter Kofler
 
FLTK Summer Course - Part II - Second Impact - Exercises
FLTK Summer Course - Part II - Second Impact - Exercises FLTK Summer Course - Part II - Second Impact - Exercises
FLTK Summer Course - Part II - Second Impact - Exercises Michel Alves
 

Andere mochten auch (20)

Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 
Multicore Explosion and its impact in application software development (Year ...
Multicore Explosion and its impact in application software development (Year ...Multicore Explosion and its impact in application software development (Year ...
Multicore Explosion and its impact in application software development (Year ...
 
Refactoring code smell
Refactoring code smellRefactoring code smell
Refactoring code smell
 
Refaktoryzacja kodu w języku PHP
Refaktoryzacja kodu w języku PHPRefaktoryzacja kodu w języku PHP
Refaktoryzacja kodu w języku PHP
 
FLTK Summer Course - Part III - Third Impact
FLTK Summer Course - Part III - Third ImpactFLTK Summer Course - Part III - Third Impact
FLTK Summer Course - Part III - Third Impact
 
TMS - Schedule of Presentations and Reports
TMS - Schedule of Presentations and ReportsTMS - Schedule of Presentations and Reports
TMS - Schedule of Presentations and Reports
 
Using Git on the Command Line
Using Git on the Command LineUsing Git on the Command Line
Using Git on the Command Line
 
FLTK Summer Course - Part I - First Impact - Exercises
FLTK Summer Course - Part I - First Impact - ExercisesFLTK Summer Course - Part I - First Impact - Exercises
FLTK Summer Course - Part I - First Impact - Exercises
 
Servicios web con Python
Servicios web con PythonServicios web con Python
Servicios web con Python
 
Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2Blisstering drupal module development ppt v1.2
Blisstering drupal module development ppt v1.2
 
FLTK Summer Course - Part VI - Sixth Impact - Exercises
FLTK Summer Course - Part VI - Sixth Impact - ExercisesFLTK Summer Course - Part VI - Sixth Impact - Exercises
FLTK Summer Course - Part VI - Sixth Impact - Exercises
 
Manipulating file in Python
Manipulating file in PythonManipulating file in Python
Manipulating file in Python
 
"Git Hooked!" Using Git hooks to improve your software development process
"Git Hooked!" Using Git hooks to improve your software development process"Git Hooked!" Using Git hooks to improve your software development process
"Git Hooked!" Using Git hooks to improve your software development process
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Git hooks For PHP Developers
Git hooks For PHP DevelopersGit hooks For PHP Developers
Git hooks For PHP Developers
 
FLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second ImpactFLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second Impact
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
FLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part VIII - Eighth ImpactFLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part VIII - Eighth Impact
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)Code Refactoring - Live Coding Demo (JavaDay 2014)
Code Refactoring - Live Coding Demo (JavaDay 2014)
 
FLTK Summer Course - Part II - Second Impact - Exercises
FLTK Summer Course - Part II - Second Impact - Exercises FLTK Summer Course - Part II - Second Impact - Exercises
FLTK Summer Course - Part II - Second Impact - Exercises
 

Ähnlich wie Code refactoring

The Power Of Refactoring (php|tek 09)
The Power Of Refactoring (php|tek 09)The Power Of Refactoring (php|tek 09)
The Power Of Refactoring (php|tek 09)Stefan Koopmanschap
 
Refactoring workshop
Refactoring workshop Refactoring workshop
Refactoring workshop Itzik Saban
 
The Power Of Refactoring (PHPCon Italia)
The Power Of Refactoring (PHPCon Italia)The Power Of Refactoring (PHPCon Italia)
The Power Of Refactoring (PHPCon Italia)Stefan Koopmanschap
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentationBhavin Gandhi
 
Project Life Cycle and Effort Estimation
Project Life Cycle andEffort EstimationProject Life Cycle andEffort Estimation
Project Life Cycle and Effort Estimationssuserb7c8b8
 
Cleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsCleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsMike Long
 
TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)Peter Kofler
 
Refactor your code: when, why and how?
Refactor your code: when, why and how?Refactor your code: when, why and how?
Refactor your code: when, why and how?Nacho Cougil
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy CodeAdam Culp
 
From silex to symfony and viceversa
From silex to symfony and viceversaFrom silex to symfony and viceversa
From silex to symfony and viceversaRonny López
 
Art of refactoring - Code Smells and Microservices Antipatterns
Art of refactoring - Code Smells and Microservices AntipatternsArt of refactoring - Code Smells and Microservices Antipatterns
Art of refactoring - Code Smells and Microservices AntipatternsEl Mahdi Benzekri
 
Modern software architect post the agile wave
Modern software architect post the agile waveModern software architect post the agile wave
Modern software architect post the agile waveNiels Bech Nielsen
 
Agile Session @ Universidade Portucalense
Agile Session @ Universidade PortucalenseAgile Session @ Universidade Portucalense
Agile Session @ Universidade PortucalenseRui M. Barreira
 
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryDOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryGene Kim
 
Coding Standard And Code Review
Coding Standard And Code ReviewCoding Standard And Code Review
Coding Standard And Code ReviewMilan Vukoje
 
Building environment of #UserDevOps and not only DevOps
Building environment of #UserDevOps and not only DevOpsBuilding environment of #UserDevOps and not only DevOps
Building environment of #UserDevOps and not only DevOpsRajnish Chauhan
 
Extreme Programming (XP): Revisted
Extreme Programming (XP): RevistedExtreme Programming (XP): Revisted
Extreme Programming (XP): RevistedMike Harris
 

Ähnlich wie Code refactoring (20)

The Power Of Refactoring (php|tek 09)
The Power Of Refactoring (php|tek 09)The Power Of Refactoring (php|tek 09)
The Power Of Refactoring (php|tek 09)
 
Refactoring workshop
Refactoring workshop Refactoring workshop
Refactoring workshop
 
The Power Of Refactoring (PHPCon Italia)
The Power Of Refactoring (PHPCon Italia)The Power Of Refactoring (PHPCon Italia)
The Power Of Refactoring (PHPCon Italia)
 
Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
 
Project Life Cycle and Effort Estimation
Project Life Cycle andEffort EstimationProject Life Cycle andEffort Estimation
Project Life Cycle and Effort Estimation
 
Cleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsCleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy Projects
 
TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)
 
Refactor your code: when, why and how?
Refactor your code: when, why and how?Refactor your code: when, why and how?
Refactor your code: when, why and how?
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
From silex to symfony and viceversa
From silex to symfony and viceversaFrom silex to symfony and viceversa
From silex to symfony and viceversa
 
Art of refactoring - Code Smells and Microservices Antipatterns
Art of refactoring - Code Smells and Microservices AntipatternsArt of refactoring - Code Smells and Microservices Antipatterns
Art of refactoring - Code Smells and Microservices Antipatterns
 
Modern software architect post the agile wave
Modern software architect post the agile waveModern software architect post the agile wave
Modern software architect post the agile wave
 
Agile Session @ Universidade Portucalense
Agile Session @ Universidade PortucalenseAgile Session @ Universidade Portucalense
Agile Session @ Universidade Portucalense
 
mehdi-refactoring.pptx
mehdi-refactoring.pptxmehdi-refactoring.pptx
mehdi-refactoring.pptx
 
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryDOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
 
Coding Standard And Code Review
Coding Standard And Code ReviewCoding Standard And Code Review
Coding Standard And Code Review
 
Refactoring.pdf
Refactoring.pdfRefactoring.pdf
Refactoring.pdf
 
Building environment of #UserDevOps and not only DevOps
Building environment of #UserDevOps and not only DevOpsBuilding environment of #UserDevOps and not only DevOps
Building environment of #UserDevOps and not only DevOps
 
Extreme Programming (XP): Revisted
Extreme Programming (XP): RevistedExtreme Programming (XP): Revisted
Extreme Programming (XP): Revisted
 

Mehr von Lalit Kale

Serverless microservices
Serverless microservicesServerless microservices
Serverless microservicesLalit Kale
 
Develop in ludicrous mode with azure serverless
Develop in ludicrous mode with azure serverlessDevelop in ludicrous mode with azure serverless
Develop in ludicrous mode with azure serverlessLalit Kale
 
For Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSecFor Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSecLalit Kale
 
Introduction To Microservices
Introduction To MicroservicesIntroduction To Microservices
Introduction To MicroservicesLalit Kale
 
Dot net platform and dotnet core fundamentals
Dot net platform and dotnet core fundamentalsDot net platform and dotnet core fundamentals
Dot net platform and dotnet core fundamentalsLalit Kale
 
Application Security Tools
Application Security ToolsApplication Security Tools
Application Security ToolsLalit Kale
 
Threat Modeling And Analysis
Threat Modeling And AnalysisThreat Modeling And Analysis
Threat Modeling And AnalysisLalit Kale
 
Application Security-Understanding The Horizon
Application Security-Understanding The HorizonApplication Security-Understanding The Horizon
Application Security-Understanding The HorizonLalit Kale
 
Coding guidelines
Coding guidelinesCoding guidelines
Coding guidelinesLalit Kale
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelinesLalit Kale
 
State management
State managementState management
State managementLalit Kale
 
Implementing application security using the .net framework
Implementing application security using the .net frameworkImplementing application security using the .net framework
Implementing application security using the .net frameworkLalit Kale
 
Data normailazation
Data normailazationData normailazation
Data normailazationLalit Kale
 
Versioning guidelines for product
Versioning guidelines for productVersioning guidelines for product
Versioning guidelines for productLalit Kale
 
Bowling Game Kata by Robert C. Martin
Bowling Game Kata by Robert C. MartinBowling Game Kata by Robert C. Martin
Bowling Game Kata by Robert C. MartinLalit Kale
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignLalit Kale
 
Web 2.0 concept
Web 2.0 conceptWeb 2.0 concept
Web 2.0 conceptLalit Kale
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsLalit Kale
 
How To Create Strategic Marketing Plan
How To Create Strategic Marketing PlanHow To Create Strategic Marketing Plan
How To Create Strategic Marketing PlanLalit Kale
 

Mehr von Lalit Kale (20)

Serverless microservices
Serverless microservicesServerless microservices
Serverless microservices
 
Develop in ludicrous mode with azure serverless
Develop in ludicrous mode with azure serverlessDevelop in ludicrous mode with azure serverless
Develop in ludicrous mode with azure serverless
 
For Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSecFor Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSec
 
Introduction To Microservices
Introduction To MicroservicesIntroduction To Microservices
Introduction To Microservices
 
Dot net platform and dotnet core fundamentals
Dot net platform and dotnet core fundamentalsDot net platform and dotnet core fundamentals
Dot net platform and dotnet core fundamentals
 
Application Security Tools
Application Security ToolsApplication Security Tools
Application Security Tools
 
Threat Modeling And Analysis
Threat Modeling And AnalysisThreat Modeling And Analysis
Threat Modeling And Analysis
 
Application Security-Understanding The Horizon
Application Security-Understanding The HorizonApplication Security-Understanding The Horizon
Application Security-Understanding The Horizon
 
Coding guidelines
Coding guidelinesCoding guidelines
Coding guidelines
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
State management
State managementState management
State management
 
Implementing application security using the .net framework
Implementing application security using the .net frameworkImplementing application security using the .net framework
Implementing application security using the .net framework
 
Data normailazation
Data normailazationData normailazation
Data normailazation
 
Opps
OppsOpps
Opps
 
Versioning guidelines for product
Versioning guidelines for productVersioning guidelines for product
Versioning guidelines for product
 
Bowling Game Kata by Robert C. Martin
Bowling Game Kata by Robert C. MartinBowling Game Kata by Robert C. Martin
Bowling Game Kata by Robert C. Martin
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Web 2.0 concept
Web 2.0 conceptWeb 2.0 concept
Web 2.0 concept
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design Patterns
 
How To Create Strategic Marketing Plan
How To Create Strategic Marketing PlanHow To Create Strategic Marketing Plan
How To Create Strategic Marketing Plan
 

Kürzlich hochgeladen

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Kürzlich hochgeladen (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

Code refactoring

  • 2. Preface • Audience: • Beginner and intermediate level of developers, technical leads and software architects • interested in software design and development • having trouble in understanding and Implementing software design Principles and Patterns • People who are keen on improving their craft • Presentation: • Approx. Time: 1 Hour • Discussion Over Monotonous Delivery • Planned slides for Questions are marked with Question Icon, Feel free to jump in to express your thoughts • Code Snippets to understand the concepts – Not Ready for Production • All Views/Opinions expressed here are mine and nothing to do with my current/past employers 2
  • 3. About Me • Working on .NET from last 11 years • Journey: Software Developer  Sr. Developer  Tech Lead  Architect • Startup To Large Enterprise • Hands on experience (Code daily for living) • Interested in software architecture of High-Volume High Traffic distributed Systems • Beginner in Python and Machine Learning 3
  • 5. Overview • What is Refactoring? • Why Refactoring? • Refactoring Myths • What To Refactor? • Workflows Of Refactoring • Refactoring Principles • Refactoring Tools • Refactoring Techniques • Refactoring Thumbnails • Summary 5
  • 7. What is Refactoring? • Wikipedia Refactoring is a redrafting process in which talk page content is moved, removed, revised, restructured, hidden, or otherwise changed. It applies only in contexts where editors make signed statements (such as talk and user namespaces),and has a number of uses, including: 7 • Improving the clarity and readability of a page • Removal of off-topic, uncivil, unclear, or otherwise distracting material • Restructuring of discussions for clarity • Relocation of material to different sections or pages where it is more appropriate
  • 8. What is Refactoring? • Ward Cunningham “Amelioration Pattern: The act of relieving ills and changing for the better” • ills = Software Rot factors • Rigidity • Fragility • Needless complexity • Toxicity 8
  • 9. What is Code Refactoring? • Martin Fowler • "Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure." - Refactoring, The design of existing Code, Martin Fowler, 1999 • “Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior. – Refactoring.com, Martin Fowler 2016 9
  • 10. What is Code Refactoring? “Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.” 10
  • 11. What is Code Refactoring? Its heart is a series of small behavior preserving transformations. Each transformation (called a “refactoring”) does little, but a sequence of transformations can produce a significant restructuring. Since each refactoring is small, it’s less likely to go wrong. The system is kept fully working after each small refactoring, reducing the chances that a system can get seriously broken during the restructuring. 11
  • 13. 13 Why Refactor? “Programs must be written for people to read, and only incidentally for machines to execute”—Abelson and Sussman
  • 14. Why Refactor? 14 Green Refactor Red Refactoring Makes code adaptable to change Write a Failing Test Do All sins to Pass the Failing Test – Kent Beck Pay for all sins and clean up code
  • 15. Why Refactor? • Keep code focused • Improving the clarity and readability of code • Removal of unclear, or otherwise distracting boilerplates and code segments • Restructuring for clarity • Helps to pay timely technical debt • Leads to lightweight pragmatic design • Avoids code rot 15
  • 16. Zen says “To move faster, you need to do it right”
  • 18. Refactoring Myths • “If It isn’t Broken, Don't Fix It” • So We do not need refactoring • Then, • You add more features • You enhance existing features • Better infrastructure emerge • Your competition change • Which Results in changing your application/system • Fact: Change is one of the strongest force in software development 18
  • 19. Refactoring Myths and Misunderstandings • Symptoms • “Refactoring Takes Time” • “We need to plan for separate refactoring time “ • “This entire project needs refactoring” • “Refactoring this project will need at least X Weeks/months” • Underlying Myth: Refactoring is one time activity/Task • Fact: Refactoring is continual Activity 19
  • 20. Refactoring Myths and Misunderstandings • Refactoring is Re-work • Fact: Refactoring gives opportunity to fix inefficiencies in system • For Refactoring, we need special tools • Fact: Tools are important but not mandatory. Refactoring Mindset is mandatory • Refactoring can replace Code Reviews • Fact: Objective of Code reviews are quite different than those of refactoring. So, you can not compare apples with oranges. 20
  • 22. What To Refactor? • In general • Code written to satisfy the feature • Unit Tests • But Can be • Database Queries and Schema • Assembly/Package Arrangements • Configurations • API Endpoints • Integration Tests 22
  • 25. Refactoring Principles • DRY – Do not Repeat Yourself “Every piece of knowledge must have a single, unambiguous, authoritative representation within a system” – Pragmatic Programmers • If nothing else, duplication is the single most enemy you can pick up in refactoring stage 25
  • 26. Refactoring Principles • KISS: Keep It Simple Stupid! • Avoid Clever code. Write Clear Code. 26
  • 27. Refactoring Principles • YAGNI – You Ain’t Gonna Need It! • Boy-Scout Rule • SOLID Principles • Greatly Helpful Practice: Pair Programming 27
  • 28. Refactoring Tools • For .NET • Visual Studio IDE • Resharper by JetBrains • CodeRush by DevExpress • JustCode by Telerik 28 • For Java • Eclipse IDE • IntelliJ • JRefactory
  • 30. Refactoring Techniques • Abstraction Focused • Encapsulate Field – force code to access the field with getter and setter methods • Generalize Type – create more general types to allow for more code sharing • Replace type-checking code with State/Strategy • Replace conditional with polymorphism 30
  • 31. Refactoring Techniques • Isolation Focused • Extract Class – moves part of the code from an existing class into a new class. • Extract Method – to turn part of a larger method into a new method. By breaking down code in smaller pieces, it is more easily understandable. This is also applicable to functions. 31
  • 32. Refactoring Techniques • Code Clarity Focused • Move Method or Move Field – move to a more appropriate Class or source file • Rename Method or Rename Field – changing the name into a new one that better reveals its purpose • Pull Up – move to a superclass • Push Down – move to a subclass 32
  • 33. Refactoring Techniques • Refactoring Catalog • http://refactoring.com/catalog/ • Problem Solution Summary of well- known refactorings • Maintained by Martin Fowler 33
  • 34. 34 Refactoring Thumbnails Refactoring catalog is overwhelming…How I can remember everything? You don’t need to… Use Refactoring Thumbnails by Sven Gorts
  • 35. Refactoring Thumbnails • Clear, Pragmatic design will only emerge, If team members share a common understanding • Common Understanding requires clear and unambiguous communication • Should be quick and simple enough to iterate • Without making actual code changes Refactoring Thumbnails is the visual technique which satisfies all these requirements 35
  • 36. Refactoring Thumbnails • Express the evolution of a design over period of time • Sequence of high-level refactoring • Present intermediate stages 36 Time
  • 37. Refactoring Thumbnails - Example • Start with : copy-paste code • Evolve to : inheritance-based reuse • Passing an : intermediate stage • End with : interface-based solution 37 Time
  • 38. 38 Refactoring Thumbnails - Example Move Feature Refactoring
  • 40. Summary • Refactoring is continuous activity and part of development workflow • Re-Engineering != Refactoring • Refactoring needs (unit+ Integration) tests to verify external behaviors. • Refactoring Tools are extremely helpful but not mandatory • Refactoring Techniques are better visualized with Refactoring Thumbnails and Evolution Charts 40
  • 41. Summary Refactoring ➔ Clean Code ➔ Faster Delivery ➔ Happy Customers  41
  • 42. Resources • https://en.wikipedia.org/wiki/Wikipedia:Refactoring_talk_pages • http://www.refactoring.com • www.Refactoring.be • Book: Refactoring: Improving the Design of Existing Code 42
  • 44. . This presentation is shared under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license. More information for this license is available at http://creativecommons.org/licenses/by-nc-sa/4.0/ All trademarks are the property of their respective owners. Lalit Kale makes no warranties, express, implied or statutory, as to the information in this presentation. Lalit Kale lalitkale@gmail.com http://lalitkale.wordpress.com