Legacy Delphi Maintenance & Modernization

You have a Delphi application that runs a real part of the business, it was written between 1998 and 2012, the person who wrote it has left, and every proposal you get back is a rewrite that costs more than the company wants to spend. I do the other thing: I take the codebase as it is, get it compiling on a supported compiler, and move it forward in steps you can ship.

What this service covers

Compiler and RTL migration

Moving a codebase from Delphi 7 / 2007 / 2009 / XE-era compilers to Delphi 11 or 12. The work that actually eats the time is rarely the IDE:

  • The ANSI → Unicode break at Delphi 2009. Every string became UnicodeString, every Length() in a byte context became wrong, and every PChar cast over a binary buffer became a silent corruption. Fixing this properly means separating text from bytes across the whole codebase — RawByteString, TBytes and AnsiString where they belong.
  • Win32 → Win64: pointer-sized integers, packed record alignment against C structures and device SDK headers, inline assembler that has to be rewritten in Pascal, and 32-bit-only COM dependencies that need an out-of-process surrogate or a replacement.
  • RTL and VCL behaviour changes between versions — TStringList delimiter and sorting semantics, FormatSettings going thread-local, stream and encoding defaults, changed exception classes — the kind of change that compiles cleanly and produces wrong numbers in production.

Data access modernisation

  • BDE → FireDAC, and dbExpress / ADO / ODBC → FireDAC, keeping the existing dataset semantics so the UI layer does not have to be rewritten in the same pass.
  • Replacing hand-built SQL string concatenation with parameterised queries, which usually closes a set of injection holes as a side effect.
  • Connection lifetime, pooling and transaction scope on long-running desktop clients that were written to hold one connection open for eight hours.
  • Retry and backoff around transient database failures — a SQL Server database in recovery or in transition, a failover that leaves stale connections in the FireDAC pool, login timeouts that should be retried rather than shown to an operator.

Dead third-party components

Almost every old Delphi project depends on at least one component set whose vendor no longer exists, whose source you do not have, or which never shipped a 64-bit build. Options I work through with you, in order of cost: find a maintained fork, replace it with a supported equivalent behind a thin adapter unit, or reimplement the subset your application actually uses. The decision is driven by how much of the component's API surface the codebase touches — which is a measurable number, not an opinion.

Build, source control and reproducibility

  • Getting a codebase that only builds on one retired machine to build from a clean checkout.
  • Converting binary DFMs to text so that form changes are reviewable in diffs.
  • MSBuild command-line builds, so the application can be built by something other than a person pressing F9.
  • Untangling library paths, package versions and unit-name collisions that accumulate over fifteen years.

Architectural modernisation, incrementally

When the goal is more than "keep it running": pulling business logic out of event handlers and into units that can be tested, putting a service boundary between the desktop client and the database, and moving parts of the system behind a REST or SOA layer so that a web or mobile client can be added without touching the original application. This is the strangler pattern applied to Object Pascal — the old client keeps working the whole time. See Delphi Backend Architecture for the target side of that work.

Subcontract capacity for software companies

A distinct case, and a common one: you are a software company, not the end customer. You have a Delphi project — inherited with an acquisition, arriving through a long-standing client, or landed because you were the only bidder willing to touch it — and no Delphi bench to put on it. Embarcadero ecosystem partners are frequently in exactly this position.

  • You keep the client relationship. I have no interest in your customer, and that can be contractual.
  • I work inside your process. Your repository, your branching model, your review process, your ticket system, your definition of done.
  • Under your NDA, and invisible if that is what you need. White-label delivery is normal in this arrangement and I have no expectation of attribution.
  • Scoped as capacity or as a piece of work. Either a defined deliverable, or an agreed number of days per month against your backlog — whichever fits how you have priced the engagement.
  • Knowledge transfer as an explicit deliverable, if you want it. The strategically sensible version of this arrangement is that your own engineers end up able to maintain the code. I would rather write that into the scope than be quietly indispensable.

How I work on a legacy codebase

  1. Build it first. Nothing else is real until the code compiles from a clean checkout on a machine I control.
  2. Characterise before changing. Where there are no tests, I put a harness around the behaviour that must not change — usually at the data or file-format boundary — before touching the code that produces it.
  3. One axis at a time. Compiler version, then data access, then architecture. Migrations that change two axes at once produce failures nobody can attribute.
  4. Ship in slices. Each step is separately deployable and separately revertable. If the engagement ends after step two, you still have a codebase in a better state than when it started.

What I will tell you honestly

Some codebases should not be migrated. If the application is 40,000 lines of forms over a schema that no longer matches the business, the migration cost will exceed a rewrite and I will say that on the first call rather than after three months of invoices. I would rather lose the engagement than take on work I do not believe in.

And sometimes the right answer is a rewrite in something other than Object Pascal. I am not arguing that Delphi is the correct choice for your next project — that decision belongs to whoever has to staff and maintain the result, and the hiring market is a legitimate engineering input, not a compromise. What I am saying is narrower and more useful: the choice between keeping and replacing a working codebase should be made on evidence rather than on discomfort with an unfamiliar language. A great deal of Delphi gets rewritten not because the code is bad but because nobody currently on the team can read it, and that is an expensive reason. Establishing what you actually have is what the first engagement is for.

Typical starting points

  • "We are on Delphi 2007 and our new laptops cannot run the toolchain any more."
  • "Our application must be 64-bit because a dependency dropped 32-bit support."
  • "The developer who wrote this retired and we need someone who can even read it."
  • "We need the desktop application and a new web client to work against the same data."
  • "It works, but it corrupts non-Latin characters and we now have customers who need them."
  • "We are a software company with a Delphi project and no Delphi developers."

The codebases I see most often are enterprise systems, ERP, HR and payroll, time attendance, manufacturing and logistics — the categories where software written in the 2000s is still load-bearing because it works and replacing it was never worth the risk.

Book a free 30-minute technical call

Bring the compiler version, the database, and the two or three things that break most often. Thirty minutes is usually enough to tell you whether this is a migration, a rescue, or a rewrite — and I will tell you which one it is even when the answer is not the one that gets me the work.

Book a free 30-minute technical call

Tell me what is broken.

No sales call. You describe the problem, I tell you whether it is something I can solve and roughly what it takes. If it sits outside what I do, I will say so on that call.

Book a free 30-minute technical call