Comparison
Refactoring or rewriting an existing app: which one, and when
A rewrite looks clean on paper and is the most expensive decision a company with a working application can make.
- 6
- sections
- 10
- questions answered
Refactoring changes an app's internal code in small, tested steps without changing what users see; rewriting throws the codebase away and rebuilds the app from scratch, so the old system must keep running until the new one reaches feature parity. Any application that has earned money for years contains rules nobody remembers any more: the exception made for a long-standing customer, the fix added after a complaint, the odd behaviour somebody's monthly report quietly depends on. Refactoring accepts that reality and changes the code in pieces while preserving behaviour: you isolate an area, cover it with tests, rewrite it, put it into production, move to the next. The application stays live throughout, and the risk is distributed in small portions. A full rewrite starts from the promise of a clean beginning, but carries an obligation rarely stated at the start of the project: the new system has to do everything the old one did, including the rules nobody can explain, before anyone can use it. During that interval, sometimes a year or more, the company pays for two teams and receives nothing new. The signals that genuinely justify a rewrite are few, but they are unambiguous, and we set them out below.
Key takeaways
What refactoring gains you
The application keeps working and keeps earning while it improves. Every step can be stopped, evaluated or reversed, and the budget is phased instead of being locked into one large project whose result is visible only at the end.
What a rewrite gains you
You escape a technology no longer receiving security fixes, a data model blocking the product, and dependence on the single person who still understands the code. You also gain delivery speed, but only after you have reached feature parity.
The principal risk of each option
Refactoring can stretch indefinitely if nobody defines an end point and success metrics. A rewrite can turn into a project that never reaches production, because the list of old features keeps growing as it is discovered.
The approach that works most often
Gradual replacement, described below: one area at a time, with visible deliveries every few weeks, the option to stop at any point, and no single big-bang day when everything can break.
Refactoring vs rewriting at a glance
What users see: with refactoring the same behaviour, with a rewrite usually a freeze on new features until parity. Risk: small reversible steps versus one big-bang switch day when the whole system changes at once. When value arrives: with refactoring in weeks, with a rewrite only after parity. Cost profile: a phased budget you can stop at any point versus front-loaded cost plus two systems paid for in parallel. Hidden business rules: with refactoring they survive because the code survives; with a rewrite they must be rediscovered one by one.
The three signals that justify a rewrite
First: the underlying technology no longer receives security updates, and the components it depends on can no longer be installed on modern systems. That is no longer a business decision but a risk decision. Second: you can no longer find people who will work in it, and those who exist charge scarcity rates and refuse long-term maintenance. Third: the data model no longer supports where the product is going — you need multiple companies, multiple currencies or multiple warehouses, and the structure assumes everywhere that there is only one.
If none of those signals applies and the real frustration is that adding a feature takes too long, then you have a problem of code organisation and testing, not of technology. That is solved through targeted refactoring guided by measurement: where the time goes, which areas break most often, which modules generate the most incidents. The investment is several times smaller and shows results within months.
Want an estimate for your project?
Message us on WhatsApp. We reply the same working day, and the first 30-minute call is free.
The middle path: strangler fig replacement
Martin Fowler named this approach the strangler fig, after the vines that grow around a tree until they replace it. He writes that like-for-like replacement plans "go down in flames most of the time". The mechanics: a routing layer in front of the old app sends one area at a time to new code, and each migrated area is switched off in the old system until the old system is empty.
The alternative has a famous example: in April 2000 Joel Spolsky noted that Netscape 6.0 was only now entering its first public beta, that there never was a version 5.0, and that the last major release had come almost three years earlier, calling the full rewrite "the single worst strategic mistake that any software company can make". The method does not fit when the third signal applies: if every area shares the one broken data model, there is nothing to move across gradually.
When you do not need us to touch anything
If the application does exactly what it should, nobody is asking for new features and incidents are rare, the best decision is to do nothing. Pay only for security updates and backups, document what exists, and keep the credentials safe. We have met companies talked into rewriting perfectly functional systems because they did not look modern; that money would have produced more almost anywhere else.
Call us when the cost of doing nothing has become visible: deliveries take months, every change breaks something else, only one person can still intervene, or the current supplier has stopped answering. We start with a short paid audit that ends in a reasoned recommendation — including, if that is what the numbers show, the recommendation to keep the current system and build separately only the part that blocks you.
Frequently asked questions
How long does a complete rewrite take, on average?
Longer than the initial estimate, almost as a rule, because the list of old features is discovered along the way. A prudent indicator is to take the supplier's estimate for reaching feature parity and double it, then ask what ships in the first three months. If the answer is nothing visible, renegotiate the approach.
How do I know the refactoring is actually progressing?
Through metrics measured monthly: time from request to delivery, the number of production incidents, automated test coverage, the duration of a release. If the supplier cannot show those figures moving, you are paying for activity rather than outcome, and the project can stretch indefinitely.
Can I run the old and the new system in parallel?
Yes, and it is the safest form of transition. The key is that data has a single source of truth at any moment, and that each migrated area is switched off definitively in the old system. Parallel running turns dangerous only when both systems write the same information.
What do I do if nobody understands the existing code any more?
Start by documenting observed behaviour rather than the code: what goes in, what comes out, which rules apply. A set of tests written against current behaviour becomes the safety net for any later intervention and, additionally, tells you exactly what a replacement system would have to reproduce.
What is the difference between refactoring and rewriting an app?
Refactoring restructures the existing code in small steps while users keep the same features; rewriting builds a replacement from nothing. The first keeps the hidden business rules and delivers value early; the second has to rediscover them and delivers value only once the new system matches the old one.
Is it cheaper to refactor or rewrite an app?
Usually refactoring, because the budget is phased and can be stopped after any step. A rewrite pays for two systems until parity, and the list of old features keeps growing as it is discovered. An exact price is impossible without auditing your application, which is why we start with a short assessment.
What is the strangler fig pattern?
It is Martin Fowler's name for gradual modernisation: the new system takes over one area of the old application at a time through a routing layer, and the taken-over area is switched off in the old one. This repeats until the old system is empty and can be retired, with no sudden switch day.
What do I do with historical data when moving to the new system?
Data migration is a project in itself and is planned from the start, not in the last month: what is migrated in full, what is only archived for reference, and how the transfer is verified. Budget roughly 10–20% of the project for it, because years of dirty data never move across on their own.
Can AI coding tools make a rewrite cheap?
They speed up writing code, but not discovering the undocumented business rules, which is the expensive part of a rewrite. Tests written against current behaviour remain the safety net, and generated code must be checked against them exactly like code written by a person.
How do I know whether the app or the supplier is the problem?
An independent technical audit tells them apart in a few days: reasonable code that was poorly maintained is fixed by changing the team; code that is fragile at its core stays fragile with anyone. Do not decide on a rewrite based only on the opinion of whoever would be paid for it.
Let’s talk about your project
Book a free 30-minute call or send us an email. We reply the same working day.
office@northdan.com · +40 750 252 851