Fictional company, realistic system. CeCons Administradora de Consórcios does not exist. The system was built to show the method on a legacy system with real weight: Brazilian consórcio rules (a group purchasing scheme regulated by Law 11.795/2008), 25 tables, 26 stored procedures, a batch, a customer portal, COM components, and the problems that pile up in twenty years of maintenance. All the code is on GitHub.

The situation

A system from 2005 that never stopped growing: a SQL Server database with SQL 2000-style procedures, a VB6 desktop, a classic ASP customer portal with a VB6 component, a WebForms back office from 2011 and a VB.NET batch from 2016. It works, the business runs on it every day, nobody knows all of it, and there isn't a single automated test.

The usual request would be "rewrite it in .NET". I did the opposite: the old system stays up and stays the reference, and the new one grows next to it, one screen at a time.

First, find out what the system does

The assessment produced 36 findings. The most expensive one for a migration: the same rule in several places, giving different results. Fines and interest were calculated in four places. The bank return batch charged a fine to customers who paid on time after a holiday, and the portal did the same after a weekend.

Instead of rewriting the rule from a document, I executed the old code and compared it with the new one: 333,960 late-fee cases. Every difference was categorized and taken to a decision; none was "fixed" silently.

The path

  1. 01 · Assessment

    What the system really does

    Inventory, business rules map and 36 findings. The billing rules were compared with the old code, running.

  2. 02 · Experiments

    Test every bet before depending on it

    Five experiments with automated tests: the new layer in front of the system, shared login, iframes, the UI technology, and two applications writing to the same database.

  3. 03 · Decisions

    Six decisions, each with its evidence

    And a plan in phases, where every phase says which part of the old system is turned off.

  4. 04 · Phase 0

    The new layer in front of the old system

    Every old screen goes through it unchanged. Along the way, it fixes a clickjacking exposure that existed today.

  5. 05 · Phase 1

    The first new screen

    Installment search on .NET 10, at the same address and with the same look as the old one. Same rows, same order, compared by a test.

  6. 06 · Phase 2

    Payment posting with a single rule

    Fines and interest from one rule, written through the old system's procedures, every rounding recorded.

Both systems at the same time

The new screen deliberately uses the old layout: people don't have to relearn anything in the middle of the migration. Both systems share the same database, and the new screen writes through the old system's own procedures, so a payment posted on the new screen shows up immediately on the old one, and the write rule stays in one place until the whole area moves.

Every new screen sits behind a switch. If something goes wrong in production, going back to the old screen is a configuration change: no deploy, no restart.

What the tests found along the way

Old screens working behind the new layer 26 of 26, 0.47 ms added per request
New boleto (Brazilian bank slip) compared with the old one 0 differences over 2,287 installments
Problems found in the old system a clickjacking exposure, a deadlock in the payment procedure, fines charged to customers who paid on time, a boleto bug due in 2050
Bug in the new screen caught before it shipped 1, a filter that returned 12 rows instead of 50, with no error
Automated tests 48

How I work

Assessment, a plan in small steps, and migration with the system running. Every important decision is recorded with the evidence behind it. The repository has the whole path: the system as received, the assessment, the experiments, the decisions and the new system.

I use AI tools to read and write code faster. The decisions, the validation and the tests are mine.

Have a system like this? Let's talk.