H-Studio logo
startup engineering · 24 January 2025 · 3 min

Refactor or Rewrite: Compare Risk, Migration and Full Cost

Choose repair, partial replacement or a rewrite using actual behaviour, migration responsibilities, cutover criteria and the cost of coexistence.

Author
Anna Hartung
  • rewrite
  • architecture
  • startup
  • technical-debt
  • refactoring

A team gathered around screens debating a fresh start

A rewrite is justified when a defined replacement has a better risk-and-cost case than improving the existing system. Frustration with old code is useful evidence that something needs investigation, but it is not yet that comparison.

Start by establishing what is running, which business outcomes it supports and what must remain available during a change. The existing system contains behaviour, exceptions and data assumptions that a new codebase will also need to handle.

Compare three options

OptionWhen to investigate itCosts that are easy to omit
Repair or refactorThe workflow and platform still fit, but specific defects block changeRegression tests, untangling dependencies and release risk
Replace a bounded partOne capability has a clear interface and an identifiable ownerData mapping, coexistence and integration during migration
Replace the wider systemFundamental constraints prevent required operation or a supported path forwardMigration, parallel maintenance, training, cutover and recovery

Unsupported components or an unsuitable data model may strengthen the replacement case. They do not establish that every surrounding component must also change.

Recover the actual behaviour

Choose the most important workflow and list normal, denied and exceptional outcomes. Compare code, production configuration and representative records. Interview operators about the workarounds that are absent from tickets.

Before changing a legacy system, verify repository-to-production parity and the ability to build and release the known version. Otherwise the team may plan against a snapshot that does not correspond to the service customers use.

Run a small investigation

Take one troublesome change and estimate all three options. Identify what remains unknown and which short experiment could resolve it. For example, can one pricing rule be isolated behind a stable interface without changing order history?

Use the experiment to test a boundary, not to build an entire replacement before making the decision. Record assumptions, acceptance criteria and an explicit stopping point if the expected benefit does not materialise.

Plan coexistence and data responsibility

Gradual replacement, often described through the Strangler Fig approach, can keep an existing service useful while a capability moves. It also creates a period in which ownership must be especially clear.

For each data item define the authoritative writer, migration method, reconciliation and recovery path. Avoid uncontrolled dual writes. An application rollback may not undo a completed data migration, so assess compatibility and restoration separately.

Set cutover criteria before the deadline

For a fictional document workflow, a cutover gate might require matching migrated records, correct permissions, known handling of missing files, a demonstrated new deployment and an agreed recovery procedure. Compare outcomes, not just row counts or screenshots.

Keep support for the old path until the dependency and recovery decision is explicit. Retiring an interface, revoking supplier access and deleting data are different actions with different scopes and responsibilities.

Decide using the full cost

Include the roadmap work delayed by the replacement, operation of both versions and the time needed to discover undocumented behaviour. Do not promise a rewrite will prevent all future rewrites, or assume that incremental work is always cheaper. Some systems do need a larger replacement.

The decision record should say what will change, why the other options were rejected, who owns the transition and which evidence permits cutover. For execution details, see evolutionary architecture. If delivery or operating control has already been lost, H-Studio's software rescue begins with establishing a safe baseline.

Keep reading

More from the engineering stream.

  1. Post · 001
    05 Nov 2026

    B2B Website Relaunch: Write a Brief and Compare Proposals

    An editable briefing template, a worked B2B example and a proposal matrix to clarify scope, responsibilities and acceptance before a website relaunch.

    Read post
  2. Post · 002
    23 Jul 2026

    EU AI Act Article 50: Product Transparency Checklist

    Article 50 implementation after 2 August 2026: AI disclosures, marking, human review and versioned release evidence for product teams.

    Read post
  3. Post · 003
    16 Jun 2026

    Fintech Engineering Partners: Scope, DORA and Operational Evidence

    How to assess a fintech engineering partner: applicable responsibilities, BAIT/DORA transition, incident processes, data flows and technical handover.

    Read post
All posts →
Get started ·  011

Let’s build what
moves you forward.

From product idea to production system — we help you define, build and hand over software your team can run.

Studio
H-Studio Berlin
Senior delivery · DACH region
Contact
hello@h-studio-berlin.de
+49 176 41762410
Office
Pappelallee 64
10437 Berlin