SlideShare a Scribd company logo
1 of 3
Download to read offline
Refactor vs. Rewrite
Ganesh Samarthyam, Tushar Sharma, Girish Suryanarayana 

REFACTOR VS REWRITE WWW.DESIGNSMELLS.COM
Refactor vs. Rewrite
Conversations such as "Oh, this is such a cluttered design", "This software has high
technical debt", and "What a complex piece of code!" may lead to exchanges such as "Can't
we do something about this?", "Why can't we scrap this?", and "Can refactoring make it
better?" Essentially, the discussion boils down to the famous dilemma "Refactor or re-
write". Let's take a closer look at the dilemma and a few factors that impact the dilemma.
When it takes more time and effort than genuinely required to fix a bug or introduce
a new feature in the software due to high technical debt (including high complexity,
tightly coupled design, and so on), the software becomes difficult to maintain. In extreme
conditions, making each change in the software becomes a painful nightmare. In such
situations, the dilemma "refactor or re-write" may capture the attention of project
stakeholders.
History has taught us that "re-write" from scratch could be strategically dangerous
for the product and the company. Joel [1] has pointed out many such mistakes; some of
them are:
Netscape released version 6 during year 2000 after three years they released version
4 and yes, there were no version 5. Why? Because, the company decided to develop the
software from scratch! It took three years for them to do it by that time they lost the
market.
Borland bought Arago to make dBase for Windows but started the development
from the scratch; before they can make to the market, MS Access captured the market. All
REFACTOR VS REWRITE WWW.DESIGNSMELLS.COM
of the above cases highlight strategic mistakes of these companies that wiped their market
share. Thus the "Risk of losing the market" is indeed a significant factor to consider when
the question (i.e. "Refactor or re-write") is posed. In this context, Refactoring could be
favored since the product is always market-ready and refactoring can consistently
improve the quality to sustain the product for a longer period.
If you think that the old software is a complete waste that doesn't deliver any value
then think again. The old huge legacy software was maintained by your company for so
long and in this duration the project team has fixed numerous bugs aroused in different
client conditions. In summary, the same piece of crap has accumulated huge knowledge
and experience which is difficult (if not impossible) to introduce at once in a software
developed from scratch. Again, from this dimension, refactoring option is fruitful
alternative to retain and exploit the knowledge captured by the old software.
Does it mean we should always opt for refactoring over re-write? Well..No. There is
at least one case when it is desirable to go for re-write. When it becomes difficult to
maintain old software technologically (difficult to get compatible hardware, software, or
people who can run the show) since the used technology is obsolete while management of
the product foresee a relatively long life for the product then re-write could be an option.
However, while opting re-write, the risk associated with first two factors must be
addressed; for instance, the management could decide to develop the new product from
scratch with new technology without removing the old product from the market.
Microsoft did the same once when they started developing Word from scratch under the
project code name Pyramid. Although, the project Pyramid was a disaster but the parallel
development saved Microsoft from losing the market.
References:	
  
[1]	
  Joel	
  Spolsky,	
  "Things	
  you	
  should	
  never	
  do,	
  Part	
  I"	
  
About	
  the	
  Authors:	
  	
  
	
  	
  
Ganesh	
   Samarthyam	
   (sgganesh@gmail.com)	
   is	
   an	
   Independent	
   Consultant	
   and	
  
Corporate	
  Trainer	
  based	
  in	
  Bangalore.	
  	
  
Tushar	
   Sharma	
   (000.tushar@gmail.com)	
   is	
   a	
   Technical	
   Expert	
   at	
   Research	
   and	
  
Technology	
  Centre,	
  Siemens	
  Technologies	
  and	
  Services	
  Pvt.	
  Ltd.,	
  Bangalore.	
  
Girish	
  Suryanarayana	
  (girish.suryanarayana@gmail.com)	
  is	
  a	
  Senior	
  Research	
  Scientist	
  
at	
   Research	
   and	
   Technology	
   Centre,	
   Siemens	
   Technologies	
   and	
   Services	
   Pvt.	
   Ltd.,	
  
Bangalore.	
  	
  
REFACTOR VS REWRITE WWW.DESIGNSMELLS.COM

More Related Content

More from Ganesh Samarthyam

More from Ganesh Samarthyam (20)

Great Coding Skills Aren't Enough
Great Coding Skills Aren't EnoughGreat Coding Skills Aren't Enough
Great Coding Skills Aren't Enough
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - Description
 
Coding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeCoding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean Code
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
 
Bangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief PresentationBangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief Presentation
 
Bangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - PosterBangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - Poster
 
Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
 
Bangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship DeckBangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship Deck
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
 
Java Generics - Quiz Questions
Java Generics - Quiz QuestionsJava Generics - Quiz Questions
Java Generics - Quiz Questions
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz Questions
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
 
Core Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quizCore Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quiz
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
Refactoring for Software Architecture Smells - International Workshop on Refa...
Refactoring for Software Architecture Smells - International Workshop on Refa...Refactoring for Software Architecture Smells - International Workshop on Refa...
Refactoring for Software Architecture Smells - International Workshop on Refa...
 
Refactoring for Software Architecture Smells - International Workshop on Refa...
Refactoring for Software Architecture Smells - International Workshop on Refa...Refactoring for Software Architecture Smells - International Workshop on Refa...
Refactoring for Software Architecture Smells - International Workshop on Refa...
 

Recently uploaded

Recently uploaded (20)

The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Sourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing ManufacturerSourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing Manufacturer
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdf
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
What is an API Development- Definition, Types, Specifications, Documentation.pdf
What is an API Development- Definition, Types, Specifications, Documentation.pdfWhat is an API Development- Definition, Types, Specifications, Documentation.pdf
What is an API Development- Definition, Types, Specifications, Documentation.pdf
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdfStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfarchitecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdf
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 
SQL Injection Introduction and Prevention
SQL Injection Introduction and PreventionSQL Injection Introduction and Prevention
SQL Injection Introduction and Prevention
 
Workforce Efficiency with Employee Time Tracking Software.pdf
Workforce Efficiency with Employee Time Tracking Software.pdfWorkforce Efficiency with Employee Time Tracking Software.pdf
Workforce Efficiency with Employee Time Tracking Software.pdf
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
Malaysia E-Invoice digital signature docpptx
Malaysia E-Invoice digital signature docpptxMalaysia E-Invoice digital signature docpptx
Malaysia E-Invoice digital signature docpptx
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 

Refactor versus rewrite

  • 1. Refactor vs. Rewrite Ganesh Samarthyam, Tushar Sharma, Girish Suryanarayana 
 REFACTOR VS REWRITE WWW.DESIGNSMELLS.COM
  • 2. Refactor vs. Rewrite Conversations such as "Oh, this is such a cluttered design", "This software has high technical debt", and "What a complex piece of code!" may lead to exchanges such as "Can't we do something about this?", "Why can't we scrap this?", and "Can refactoring make it better?" Essentially, the discussion boils down to the famous dilemma "Refactor or re- write". Let's take a closer look at the dilemma and a few factors that impact the dilemma. When it takes more time and effort than genuinely required to fix a bug or introduce a new feature in the software due to high technical debt (including high complexity, tightly coupled design, and so on), the software becomes difficult to maintain. In extreme conditions, making each change in the software becomes a painful nightmare. In such situations, the dilemma "refactor or re-write" may capture the attention of project stakeholders. History has taught us that "re-write" from scratch could be strategically dangerous for the product and the company. Joel [1] has pointed out many such mistakes; some of them are: Netscape released version 6 during year 2000 after three years they released version 4 and yes, there were no version 5. Why? Because, the company decided to develop the software from scratch! It took three years for them to do it by that time they lost the market. Borland bought Arago to make dBase for Windows but started the development from the scratch; before they can make to the market, MS Access captured the market. All REFACTOR VS REWRITE WWW.DESIGNSMELLS.COM
  • 3. of the above cases highlight strategic mistakes of these companies that wiped their market share. Thus the "Risk of losing the market" is indeed a significant factor to consider when the question (i.e. "Refactor or re-write") is posed. In this context, Refactoring could be favored since the product is always market-ready and refactoring can consistently improve the quality to sustain the product for a longer period. If you think that the old software is a complete waste that doesn't deliver any value then think again. The old huge legacy software was maintained by your company for so long and in this duration the project team has fixed numerous bugs aroused in different client conditions. In summary, the same piece of crap has accumulated huge knowledge and experience which is difficult (if not impossible) to introduce at once in a software developed from scratch. Again, from this dimension, refactoring option is fruitful alternative to retain and exploit the knowledge captured by the old software. Does it mean we should always opt for refactoring over re-write? Well..No. There is at least one case when it is desirable to go for re-write. When it becomes difficult to maintain old software technologically (difficult to get compatible hardware, software, or people who can run the show) since the used technology is obsolete while management of the product foresee a relatively long life for the product then re-write could be an option. However, while opting re-write, the risk associated with first two factors must be addressed; for instance, the management could decide to develop the new product from scratch with new technology without removing the old product from the market. Microsoft did the same once when they started developing Word from scratch under the project code name Pyramid. Although, the project Pyramid was a disaster but the parallel development saved Microsoft from losing the market. References:   [1]  Joel  Spolsky,  "Things  you  should  never  do,  Part  I"   About  the  Authors:         Ganesh   Samarthyam   (sgganesh@gmail.com)   is   an   Independent   Consultant   and   Corporate  Trainer  based  in  Bangalore.     Tushar   Sharma   (000.tushar@gmail.com)   is   a   Technical   Expert   at   Research   and   Technology  Centre,  Siemens  Technologies  and  Services  Pvt.  Ltd.,  Bangalore.   Girish  Suryanarayana  (girish.suryanarayana@gmail.com)  is  a  Senior  Research  Scientist   at   Research   and   Technology   Centre,   Siemens   Technologies   and   Services   Pvt.   Ltd.,   Bangalore.     REFACTOR VS REWRITE WWW.DESIGNSMELLS.COM