Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
  1. Home
  2. Blog
  3. Repair or Replace
Python & Django

Repair or Replace

Should you fix or rewrite an ageing Python service? When a rewrite is justified, why it must match years of hidden business rules, and the cheaper option.

Updated 2 min readBy SpiderHunts Technologies

Free estimateNo obligation

Get a free estimate

Tell us what you need. A senior engineer reads every enquiry.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →

Quick answer — TL;DR

Rewrite when the requirements have genuinely changed or when understanding it costs more than replacing it. Otherwise fix the specific problems — it is cheaper and lower risk.

Rewrites fail more often than they succeed

A rewrite must reach parity with a system that absorbed years of business rules and edge cases, while the original keeps running and changing.

The rewrite abandoned at eighty per cent complete is a genuinely common outcome, and it costs more than the problem it was meant to solve.

Genuine reasons to rewrite

  1. The business requirements have fundamentally changed
  2. The original is so poor that understanding it costs more than rebuilding
  3. It depends on something no longer available or supported
  4. The data model cannot express what the business now does

Notice that “it uses an old framework” and “it is not how I would have written it” are not on that list.

Usually fixable instead

ComplaintActual fix
SlowQuery and index work
FragileError handling and retries
Fails silentlyMonitoring and alerting
Hard to changeTests, then incremental refactoring
Outdated dependenciesUpdate them, one at a time

The incremental alternative

New functionality in a modern structure alongside the old code, with old functionality moving across as it needs changing anyway.

Over a year the system modernises without ever being unavailable and without a single high-risk cutover.

If you do rewrite

  • Characterise the existing behaviour with tests first
  • Run both in parallel and compare output before switching
  • Migrate one component at a time where possible
  • Keep the old one running until the new one is proven
  • Accept that it will find rules nobody documented

FAQ

Frequently asked questions

The questions readers ask us after this guide.

Still have a question?

Ask us directly — a senior engineer will get back to you.

Ask about your project

How do we decide?

List what is actually wrong. If it is four specific things, fix them. If the model no longer fits the business, rewrite.

What if nobody understands it?

Assess it first. Frequently the code is comprehensible and the documentation was the missing part.

Can we rewrite incrementally?

Usually, and it is nearly always the better approach. Component by component, with the old system running throughout.

How long does a rewrite take?

Longer than the estimate, consistently. That is the main argument for incremental replacement.

Keep reading

More on Python & Django

Python & Django

An API Other Systems Can Depend On

Designing a Python API service others can depend on: validation at the boundary, consistent errors and status codes, early versioning and documentation.

Python & Django

Moving and Transforming Data Reliably

Building data pipelines in Python that cope with malformed input: restartable stages, quarantining failures, reconciling counts and alerting on absence.

Start here

Been told a system needs rewriting?

Sometimes true, often not. Tell us what is wrong and we will give a straight assessment.

  1. You tell us what you needTwo minutes on the form, or a message on WhatsApp.
  2. A senior engineer reviews itAnd comes back with questions, a realistic range and an honest view on fit.
  3. Free 30-minute scoping callWe talk through scope, options and a realistic estimate — with no obligation.
Free estimateNo obligation

Talk to someone who builds this

Send a short brief and we will come back with an honest view and a realistic range.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →