WorldwideTradeX is an Istanbul-based product sourcing and export company serving business buyers.

Back to Custom Software & ERP Development for B2B Trade
Legacy Software Modernization: Read the Old Code, Rebuild It - Details

Legacy Software Modernization: Read the Old Code, Rebuild It

Last updated:

A company has run the same program for twenty years. It encodes how orders are priced, how stock is reserved, how invoices are numbered, how a customer gets a credit limit and how a shipment is released. Then the server it lives on reaches end of life, the runtime it was compiled for is no longer installable, and the developer who wrote it retired years ago without leaving documentation. The program still works. Nothing around it does. This is the ordinary starting point of legacy software modernization, and it is a reading problem before it is a programming problem: someone has to read the old language, recover the rules that only exist inside the code, and write those rules again in a language and architecture that a new server, a new team and a new decade can actually support.

WorldwideTradeX approaches this as code archaeology followed by disciplined re-engineering. We do not begin with a framework choice or a rewrite estimate. We begin by reading: the source, the database schema, the batch jobs, the reports, the interfaces, the printouts the warehouse still uses. Only when the behaviour of the old system is written down in plain language can anyone decide whether to re-host it, wrap it, translate it, rebuild it or retire it — and only then can a migration budget mean anything.

This guide covers the technical and commercial anatomy of legacy software modernization: what makes a system legacy, how to read an undocumented codebase, the realistic options between "keep it running" and "replace it", what automated code translation can and cannot do, how to migrate data without silently changing history, how to test behaviour parity, and how an engagement is structured. If you are carrying a system that no one left in the company fully understands, describe it in a request a quote and we will scope the reading phase first.

What Makes a System "Legacy" — and Why It Still Matters

Legacy is not a synonym for old. A ten-year-old PHP application can be legacy if nobody can deploy it safely; a thirty-year-old COBOL payroll system can be perfectly maintainable if the rules are documented and the runtime is supported. The defining conditions are technical and organisational at the same time: the platform is out of support, the toolchain cannot be reproduced, the original authors are gone, the documentation is missing or wrong, and every change carries a fear disproportionate to its size.

The business logic inside such a system is usually the most valuable asset the company owns in software terms. Two decades of edge cases are encoded there: the customer who always gets a manual discount, the route that must be split because of a customs rule, the invoice series that has to restart in January, the rounding convention that finance signed off in 2009 and nobody dares touch. A modernization project that throws that behaviour away and rebuilds "cleanly" from a business analyst's imagination will produce a modern system that is wrong in a hundred small ways, and the organisation will quietly keep a spreadsheet beside it to compensate.

That is why legacy modernization is not the same as writing a new application. The hard part is not the new technology stack; it is recovering and preserving behaviour that was never written down anywhere except in code, in database constraints and in the memory of a few long-serving employees. The second hard part is doing it while the old system keeps processing live business every day.

Code Archaeology: Reading a System Nobody Documented

The first phase of any honest migration is an inventory that answers, in writing, what the system actually does. We treat this as an investigation with evidence, not a workshop with opinions.

Source inventory. How many programs, screens, reports, batch jobs, triggers, stored procedures and scheduled scripts exist, in which languages, with which third-party libraries, and which of them are actually reachable? Dead code is common in systems this age, and a line count that includes ten years of abandoned experiments is a bad basis for an estimate.

Data model recovery. The database is often the most reliable document in the building. Table names, foreign keys, check constraints, triggers and the actual distribution of values tell you what the application assumes. We compare the schema against the code, because the places where they disagree are usually where the undocumented rules live.

Rule extraction. Pricing tiers, credit limits, tax handling, unit conversions, approval thresholds, numbering series, allocation logic, cut-off times. Each rule is written as a plain-language statement with a reference to the code or query that implements it, and, where possible, a sample of real records that exercise it. This rule register becomes the specification for whatever comes next, and it is the single most reusable artefact of the whole project.

Interface mapping. Which files are exchanged with customers, banks, customs brokers, marketplaces, ERP modules or e-invoice platforms? What are the record layouts, encodings, delimiters and failure behaviours? Fixed-length files with EBCDIC or Windows-1254 encodings are still common in trade and logistics, and they fail silently when a new system assumes UTF-8.

Operational reality. Who starts the system in the morning, which jobs run at night, what happens when a job fails, what the month-end sequence is, which reports are printed and which are only kept because an auditor asks for them. This is where a migration plan usually discovers constraints that no specification mentions.

The output is a system dossier: architecture diagram, data dictionary, rule register, interface catalogue, risk list and a list of questions only the business can answer. It is also the moment when the estimate stops being a guess.

The Real Options: From Re-Hosting to Retirement

"Modernize" is not one decision. There is a spectrum, and the right answer differs per system, sometimes per module. The recognised families are:

Re-host (lift and shift). Move the application to a supported server, virtual machine or container without changing its logic. This is the cheapest option and the fastest way to survive an end-of-life operating system, but it carries the technical debt forward and usually requires compatibility work on runtime versions, database drivers and file paths.

Re-platform. Keep the application but replace selected infrastructure layers: a new database engine, a managed file store, a modern authentication provider, a supported Java or .NET runtime. Useful when the logic is sound but one layer is the actual risk.

Refactor. Improve the internal structure — extract modules, remove dead code, replace unsafe libraries, add tests — without changing external behaviour. Often the sensible first step before any larger move, because it makes the system readable enough to migrate deliberately.

Re-architect. Rebuild parts of the system as services, typically behind a facade, so the old and new worlds coexist. The strangler pattern is the standard reference: a routing layer sends a growing share of traffic to new components while the legacy system still handles the rest, and each step is independently reversible.

Rebuild (rewrite). Write the system again in a modern stack, using the rule register as the specification. This is the option most often proposed and the one most often underestimated, because it moves the risk from technology to requirements: everything the old system did implicitly must now be stated explicitly.

Replace with a package. Buy a standard ERP, WMS or billing product and migrate onto it. Viable when the business's processes are close to the package's assumptions; dangerous when the company's competitive advantage is precisely the non-standard behaviour encoded in its old software.

Retire. Some modules exist only because a report was once requested. Decommissioning them is a modernization win and costs nothing but a decision.

A serious assessment scores each candidate against business criticality, technical risk, cost, time to first value and reversibility. It is normal for a portfolio to end up with a mix: re-host the warehouse terminal, re-platform the database, strangler the pricing engine, retire three reports and rebuild the customer portal.

Translating Old Code: What Automated Conversion Can and Cannot Do

Clients often ask whether the old code can simply be "translated" into a new language, the way a document is translated. The honest answer is that automated code translation is a real technique with a narrow, useful role — and a poor fit as the whole strategy.

Tools exist that convert COBOL to Java, RPG to C#, Delphi or Visual Basic 6 to .NET, PowerBuilder to web frameworks, PL/SQL to another dialect, Classic ASP to ASP.NET. They work best when the source is structurally regular, the target idiom is close, and the conversion is followed by human review. They produce compilable output surprisingly often. They rarely produce maintainable output on their own, because legacy code is full of constructs that have no direct equivalent: global state, implicit screen IO, goto-based control flow, decimal arithmetic with bank-specific rounding, database access embedded in presentation code, and twenty years of patches layered on the same procedure.

Where translation does earn its place:

  • Mechanical layers. Data access, file parsing, record layout definitions, utility routines, date and number formatting.

  • Scaffolding for a rewrite. Generating a first draft of hundreds of small screens or reports that a team then reviews, instead of typing them by hand.

  • Analysis. Parsers and transpilers are excellent at producing call graphs, dependency maps and complexity metrics — reading tools rather than writing tools.

  • Proof of equivalence. A generated version can be run side by side with the original against the same inputs to detect behavioural differences early.
Where it fails: business rules expressed through side effects, transaction semantics that depend on the old runtime, batch scheduling assumptions, undocumented database triggers, and anything where "it compiles" is mistaken for "it behaves the same". A rule of thumb from practice: automated conversion can remove a large share of the typing, but it does not remove the need to understand the system, and understanding is where the schedule risk sits.

Our own sequence is therefore: read and document the rules, decide the target architecture, translate the mechanical parts with tooling, and hand-write the parts that carry commercial logic — with tests that prove both versions agree.

Data Migration Without Rewriting History

In most legacy projects the data outlives the code, and errors in data migration are far more expensive than errors in code, because they are discovered late and cannot always be reversed.

Schema mapping starts from the recovered data dictionary, not from the old table list. A one-to-one copy is rarely right: the old schema often stores the same fact three times for performance reasons, uses overloaded columns, or encodes status as a single character that means different things per module. Each target field needs a stated source, a transformation rule and an owner who accepts it.

Encoding and collation deserve explicit treatment. Turkish, Cyrillic, Arabic and Greek data passing through a Latin-1 legacy database will lose characters, and the loss is silent. We test round-trips on real records, not on sample text.

Historical integrity. Invoices, ledger entries, shipments and audit records usually must remain exactly as issued, including their original numbers, dates, amounts and rounding. A migration that "cleans" history creates a compliance problem. Where the old system allowed inconsistent states, the target must reproduce them or record them explicitly as exceptions, not silently normalise them.

Reconciliation. Every migration needs a control total per entity and per period: record counts, sums, min/max keys, hash of key business fields. Reconciliation reports are signed off before cutover, and the same reports are re-run after cutover.

Cutover strategy. Big-bang cutovers are sometimes unavoidable for a monolith, but they concentrate risk into one weekend. Where possible we prefer a phased approach: migrate master data early, run the new system in read-only or shadow mode, then move transactional modules one at a time, with a defined rollback point for each.

Parallel run. Running old and new systems side by side for a defined period is the strongest evidence that behaviour parity has been achieved. It is also the phase clients most often want to skip to save time, and the phase that most often pays for itself.

Building the Target: Architecture, Security and Operations

A modernization that lands on an unsupported platform two years later has not solved anything. The target design has to be boring in the right ways.

Runtime and dependencies. Choose a runtime with a published support horizon, pin versions, keep the dependency list small, and make the build reproducible. If the application must run on the customer's own server, deliver it as a container image or an installer that a competent system administrator can deploy without the original author.

Database. Migrating off an end-of-life database engine is often the largest single work item. It is also the moment to fix charset, time zone handling, decimal precision and backup strategy. Open engines such as PostgreSQL are a common target for good reasons: predictable licensing, mature tooling, and a skills market that will still exist in ten years.

Identity and access. Legacy systems frequently authenticate against a local table with unsalted hashes, or trust the network. The rebuild is the moment to integrate with the company's directory, enforce role-based access, separate duties for approval workflows and keep an audit trail of who changed what.

Interfaces. Every inbound and outbound integration gets an explicit contract, retry policy, dead-letter path and monitoring. Silent integration failure is the classic way a modernised system loses trust in its first month.

Backups and recovery. Define recovery time and recovery point objectives with the business, test restores, and keep at least one copy outside the primary hosting provider. A backup that has never been restored is a hope, not a control.

Observability. Logs, metrics, error tracking and a health endpoint from day one. The old system survived on the operator's intuition; the new one should not depend on it.

Security patching. A support contract that includes runtime updates, dependency updates and a documented patch cadence. Most "legacy" disasters are unpatched components, not old business logic.

Delivery Model: Phases, Evidence and Ownership

Legacy modernization fails more often from unbounded scope than from technical difficulty. The engagement structure matters as much as the architecture.

Phase 1 — Reading and assessment. Fixed-scope, fixed-price where possible: system dossier, rule register, risk list, options paper with costs and a recommended path. The deliverable is a decision the management team can actually make.

Phase 2 — Target design and proof. Architecture, data mapping, interface contracts and a thin vertical slice built end to end: one real workflow, migrated data, working screens, tests. The slice proves the approach before the budget commits to the whole system.

Phase 3 — Incremental delivery. Modules delivered in business priority order, each with acceptance criteria written in business language, automated regression tests and a rollback path. Progress is measured in working functionality, not in lines of code or percentage complete.

Phase 4 — Cutover and hypercare. Data freeze, final reconciliation, parallel run, go-live, and a defined hypercare period with response times agreed in advance.

Phase 5 — Handover. Source code, build scripts, infrastructure documentation, runbooks, test suites and a training session for the internal team. Ownership of the code and the data must be unambiguous in the contract; where the client wants protection against a supplier disappearing, source code escrow is a reasonable instrument.

Two contractual details prevent most disputes: a written definition of "done" per module, and an explicit rule for change requests, because legacy systems always reveal one more rule in week six.

Cost Drivers, Timelines and Failure Patterns

Budgets in this field vary by an order of magnitude for systems that look similar from the outside. The drivers are consistent:

  • Documentation quality. A system with a maintained data dictionary and a rule register migrates several times faster than one where every rule must be inferred.

  • Coupling. Embedded SQL in screen code, triggers that call programs, shared global state and file-based integration all raise cost.

  • Data volume and quality. Duplicate customers, orphan records, mixed encodings and free-text fields that should have been codes.

  • Integration surface. Each external interface adds a contract, a test harness and an operational failure mode.

  • Uptime constraints. A system that can be down for a weekend is a different project from one that cannot be down for an hour.

  • Testability. If the old system has no test data and no reproducible environment, building the safety net becomes part of the project.
The recurring failure patterns are equally consistent. Rewriting from a business analyst's summary without reading the code produces a system that is modern and wrong. Translating everything automatically and shipping it without equivalence tests produces a system that compiles and misprices. Migrating data at the end, instead of designing the mapping at the beginning, produces a go-live that slips quarter after quarter. And refusing to retire anything produces a "modernized" estate that is larger, more expensive and no less fragile than the original.

FAQ

Can you work with a system whose original developer is gone and whose source is incomplete?
Yes, with a caveat: the reading phase becomes larger. If source is partially missing, we reconstruct behaviour from the running system, the database, the reports and interviews with the people who use it daily, and we document what is inferred rather than observed.

Is it cheaper to rewrite or to re-host?
Re-hosting is almost always cheaper in the short term and merely defers the problem. Rewriting is justified when the platform is unsupported, the business rules must change anyway, or the current system blocks growth. The assessment exists to put numbers on both.

Do we have to stop the business during migration?
Not usually. Phased delivery, shadow running and parallel periods are designed precisely to avoid a single all-or-nothing weekend, except where the monolith's data model makes it unavoidable.

Can old COBOL, Delphi or Visual Basic code be converted automatically?
Parts of it can, and we use tooling where it helps. Commercial logic almost always needs human translation with equivalence tests, because the old behaviour — including its quirks — is the specification.

Who owns the new code?
The client, contractually, including build scripts and documentation. We recommend that this is stated explicitly and, where relevant, backed by escrow.

How long does a typical modernization take?
The reading phase is usually weeks, not months. Delivery ranges from a few months for a contained module to a multi-phase programme for a core ERP. The assessment produces a schedule with named assumptions rather than a single number.

Teams often run this service alongside 1C:Enterprise Accounting: Install, Update, Custom Modules and B2B Ordering Portal for Distributors; each page sets out its own scope, delivery model and the questions to settle before starting.

Next Step

If a system your business depends on no longer runs on a supported server, and the person who understood it has left, the first useful deliverable is not a proposal for a rewrite. It is a written account of what the system does, what it would cost to keep, and what it would cost to replace — module by module.

Related services: custom software development, digital infrastructure, AI and automation and IT audit and consulting. For a scoped reading phase or a migration plan, request a quote or call +90 505 679 78 03.

Related Topics

1C:Enterprise Accounting: Install, Update, Custom Modules → B2B Ordering Portal for Distributors: Scope Guide → Invoice Matching & Customs Document Automation → IT Outsourcing from Türkiye: Vendor Selection → Odoo ERP for Trading Companies: Rollout Guide → Türkiye E-Invoice Integration for ERP Systems → Software Vendor RFP Checklist for B2B Buyers →
WhatsApp