SlideShare a Scribd company logo
Refactor vs.
Rewrite
by Roman Labunsky
datree.io
AGENDA
● How to choose between the two
● A third option!
● A Practical example
● About me
● About datree
● What is legacy code?
● Refactor vs. Rewrite
● 33 Years old
● Have 2 dogs
● Love unboxing
● Love clean code and
elegant architecture
● Engineering manager
at datree
WHO AM I
See Your R&D Stack in Action
Gain full visibility into your code components
Enhance collaboration
Old technology | Old language | Old developer | No tests | Time
Legacy code is source code that relates to a no-longer supported or
manufactured operating system or other computer technology.
- Wikipedia
WHAT IS LEGACY CODE?
A rewrite is the act or result of re-implementing a large
portion of existing functionality without re-use of its source
code or writing inscription.
Refactor Rewrite
Fast iterations Long term commitment
Same underlying technology/architecture Free to choose technology
Same Project New Project/Component
Maintain one system Maintain two systems(at least)
Code refactoring is the process of restructuring existing
computer code — changing the factoring — without
changing its external behavior.
REFACTOR VS. REWRITE
Programmers are, in their hearts, architects, and the first thing they
want to do when they get to a site is to bulldoze the place flat and
build something grand.
- Joel Spolsky
How to Choose?
● Are you doing a larger architectural shift? Microservices? Serverless?
● Will current underlying technology support future requirements?
● Is it the core of your business?
YOU DON’T HAVE TO CHOOSE!
1. Write new code.
2. Intercept events triggering old
code with new code.
3. Capture the assets!
4. Rinse repeat 1-3 till old code is
“strangled”
5. Retire old system
STRANGLER APPLICATION
USERS SERVICE
DB
Update UserGet UserCreate User Delete User
Update UserGet UserCreate User Delete User
Update UserGet UserCreate User Delete User
OLD USER
SERVICE
NEW USER SERVICE
PHASE #1
Trigger
Update UserGet UserCreate User Delete User
Update UserGet UserCreate User Delete User
OLD USER
SERVICE
NEW USER SERVICE
PHASE #2
Trigger
Update UserGet UserCreate User Delete User
Update UserGet UserCreate User Delete User
OLD USER
SERVICE
NEW USER SERVICE
PHASE #3
Trigger
Update UserGet UserCreate User Delete User
Update UserGet UserCreate User Delete User
OLD USER
SERVICE
NEW USER SERVICE
PHASE #4
Trigger
Update UserGet UserCreate User Delete User
Update UserGet UserCreate User Delete User
OLD USER
SERVICE
NEW USER SERVICE
PHASE #5
Trigger
NEW USERS SERVICE
DB
Update UserGet UserCreate User Delete User
QUESTIONS?
roman@datree.io
@RomanLabunsky
THANK YOU

More Related Content

What's hot (13)

PDF
Software testing
MadeEasyCTC
 
PDF
Refine your ci:cd pipeline with automated test
Malang QA Community
 
PPTX
Scala from the Trenches - Java One 2016
Kfir Bloch
 
PDF
Waiting on Machines
YOPESO
 
ODP
Coding Dojo - Refactoring Tennis Kata
Alin Pandichi
 
PPTX
What is dev ops?
Mukta Aphale
 
PPTX
Turpentine OSS
Miguel Ignacio Balparda
 
PDF
Chat interfaces for continuous integration - CI/CD Pipeline on Slack
Troops Engineering
 
PDF
Refactoring the Tennis Kata (2013)
Peter Kofler
 
PPTX
Agile code quality metrics
Gil Nahmias
 
PPTX
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
DevOpsDays Tel Aviv
 
PPTX
ML.NET Model Lifecycle with Azure DevOps - Devops heroes 2019
Marco Zamana
 
PPTX
Code Quality Assurance
Bart Blommaerts
 
Software testing
MadeEasyCTC
 
Refine your ci:cd pipeline with automated test
Malang QA Community
 
Scala from the Trenches - Java One 2016
Kfir Bloch
 
Waiting on Machines
YOPESO
 
Coding Dojo - Refactoring Tennis Kata
Alin Pandichi
 
What is dev ops?
Mukta Aphale
 
Turpentine OSS
Miguel Ignacio Balparda
 
Chat interfaces for continuous integration - CI/CD Pipeline on Slack
Troops Engineering
 
Refactoring the Tennis Kata (2013)
Peter Kofler
 
Agile code quality metrics
Gil Nahmias
 
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
DevOpsDays Tel Aviv
 
ML.NET Model Lifecycle with Azure DevOps - Devops heroes 2019
Marco Zamana
 
Code Quality Assurance
Bart Blommaerts
 

Similar to Code Refactoring or Rewrite: How to Properly Dispose of Legacy Code (20)

PPTX
DevOps interview questions and answers
HopeTutors1
 
PDF
agile refactoring and integration techniques.pdf
shreyassoni7
 
PDF
From hello world to goodbye code
Kim Moir
 
PDF
From prototype to production - The journey of re-designing SmartUp.io
Máté Lang
 
PDF
Scilab Enterprises (Numerical Computing)
FikrulAkbarAlamsyah
 
PDF
OpenNebulaConf2019 - Welcome and Project Update - Ignacio M. Llorente, Rubén ...
OpenNebula Project
 
PDF
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
Tal Hibner
 
DOC
Mannu_Kumar_CV
Mannu Kumar
 
PDF
Pitch Deck Teardown: Encore's $3M Pre-seed / Seed deck
HajeJanKamps
 
PDF
Delivery at Scale
Adrian Perreau de Pinninck
 
PDF
Delivery at Scale
Agilar
 
PDF
Preparing for Neo - Singapore OutSystems User Group October 2022 Meetup
YashrajNayak4
 
PDF
Gitlab ci-cd
Dan MAGIER
 
PPTX
Deploying more technology to shift from agility to anti-fragility
Spyros Lambrinidis
 
PDF
Fifteen Years of DevOps -- LISA 2012 keynote
Geoff Halprin
 
PDF
Taking your code to production
muayyad alsadi
 
DOC
Guruprasad
Guruprasad S
 
PDF
TDX2025 SFwelly April 2025 presented by David Smith
Anna Loughnan Colquhoun
 
PPTX
Agile Values, Principles and Practices
jackcrews
 
PPTX
Essential Tools for Modern PHP
Alex Weissman
 
DevOps interview questions and answers
HopeTutors1
 
agile refactoring and integration techniques.pdf
shreyassoni7
 
From hello world to goodbye code
Kim Moir
 
From prototype to production - The journey of re-designing SmartUp.io
Máté Lang
 
Scilab Enterprises (Numerical Computing)
FikrulAkbarAlamsyah
 
OpenNebulaConf2019 - Welcome and Project Update - Ignacio M. Llorente, Rubén ...
OpenNebula Project
 
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
Tal Hibner
 
Mannu_Kumar_CV
Mannu Kumar
 
Pitch Deck Teardown: Encore's $3M Pre-seed / Seed deck
HajeJanKamps
 
Delivery at Scale
Adrian Perreau de Pinninck
 
Delivery at Scale
Agilar
 
Preparing for Neo - Singapore OutSystems User Group October 2022 Meetup
YashrajNayak4
 
Gitlab ci-cd
Dan MAGIER
 
Deploying more technology to shift from agility to anti-fragility
Spyros Lambrinidis
 
Fifteen Years of DevOps -- LISA 2012 keynote
Geoff Halprin
 
Taking your code to production
muayyad alsadi
 
Guruprasad
Guruprasad S
 
TDX2025 SFwelly April 2025 presented by David Smith
Anna Loughnan Colquhoun
 
Agile Values, Principles and Practices
jackcrews
 
Essential Tools for Modern PHP
Alex Weissman
 
Ad

Recently uploaded (20)

PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Kubernetes - Architecture & Components.pdf
geethak285
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Ad

Code Refactoring or Rewrite: How to Properly Dispose of Legacy Code

  • 1. Refactor vs. Rewrite by Roman Labunsky datree.io
  • 2. AGENDA ● How to choose between the two ● A third option! ● A Practical example ● About me ● About datree ● What is legacy code? ● Refactor vs. Rewrite
  • 3. ● 33 Years old ● Have 2 dogs ● Love unboxing ● Love clean code and elegant architecture ● Engineering manager at datree WHO AM I
  • 4. See Your R&D Stack in Action Gain full visibility into your code components Enhance collaboration
  • 5. Old technology | Old language | Old developer | No tests | Time Legacy code is source code that relates to a no-longer supported or manufactured operating system or other computer technology. - Wikipedia WHAT IS LEGACY CODE?
  • 6. A rewrite is the act or result of re-implementing a large portion of existing functionality without re-use of its source code or writing inscription. Refactor Rewrite Fast iterations Long term commitment Same underlying technology/architecture Free to choose technology Same Project New Project/Component Maintain one system Maintain two systems(at least) Code refactoring is the process of restructuring existing computer code — changing the factoring — without changing its external behavior. REFACTOR VS. REWRITE
  • 7. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. - Joel Spolsky How to Choose? ● Are you doing a larger architectural shift? Microservices? Serverless? ● Will current underlying technology support future requirements? ● Is it the core of your business?
  • 8. YOU DON’T HAVE TO CHOOSE!
  • 9. 1. Write new code. 2. Intercept events triggering old code with new code. 3. Capture the assets! 4. Rinse repeat 1-3 till old code is “strangled” 5. Retire old system STRANGLER APPLICATION
  • 10. USERS SERVICE DB Update UserGet UserCreate User Delete User
  • 11. Update UserGet UserCreate User Delete User Update UserGet UserCreate User Delete User OLD USER SERVICE NEW USER SERVICE PHASE #1 Trigger
  • 12. Update UserGet UserCreate User Delete User Update UserGet UserCreate User Delete User OLD USER SERVICE NEW USER SERVICE PHASE #2 Trigger
  • 13. Update UserGet UserCreate User Delete User Update UserGet UserCreate User Delete User OLD USER SERVICE NEW USER SERVICE PHASE #3 Trigger
  • 14. Update UserGet UserCreate User Delete User Update UserGet UserCreate User Delete User OLD USER SERVICE NEW USER SERVICE PHASE #4 Trigger
  • 15. Update UserGet UserCreate User Delete User Update UserGet UserCreate User Delete User OLD USER SERVICE NEW USER SERVICE PHASE #5 Trigger
  • 16. NEW USERS SERVICE DB Update UserGet UserCreate User Delete User

Editor's Notes

  • #6: As soon as it’s tagged as legacy it becomes the badlands, people forget the rules and do what they want, thinking it’s soon be dead.