AI legacy code modernization: from untouchable systems to understandable software

Contents

Most companies have at least one critical system that is too important to switch off and too risky to change. It may have been built years ago, in a technology that only a few people still know well. It may be poorly documented, heavily customized, and full of business logic that exists nowhere else. Yet it continues to run essential operations every day.

This is the reality of legacy software. It may look like a technical problem, but for many organizations it has become a strategic business risk. Legacy systems slow innovation, consume IT budgets, complicate integration with modern platforms, and make even small business changes difficult to deliver.

Generative AI is changing how companies approach this challenge. Not because it can magically rewrite decades of code overnight, but because it can help teams do something that has always been painfully slow: understand what legacy systems actually do. In legacy code modernization, that understanding is often the difference between a controlled modernization process and a costly failure.

 

The legacy trap: why old systems become so hard to change

Legacy systems are rarely just “old applications.” They are often deeply embedded in how the business operates. They process transactions, calculate prices, generate invoices, manage customer data, support compliance, or connect multiple internal and external systems.

That makes modernization difficult for several reasons:

  • Business-critical role—downtime can affect revenue, customers, compliance, partners, and daily operations.
  • Hidden business logic—business rules, calculations, exceptions, and workarounds are often scattered across multiple places in the source code, making them difficult to identify, understand, and maintain.
  • Poor documentation—comments are missing or no longer valid, system documentation is outdated, and the original developers may no longer be available.
  • Unclear dependencies—a small code change can affect databases, reports, batch jobs, APIs, integrations, or downstream processes.
  • Accumulated technical debt—years of patches, customizations, and quick fixes make the system architecture harder to read.
  • Scarce skills—older languages, frameworks, and platforms become more expensive to maintain as specialists become harder to find.

 

This is how the “untouchable system” is created: too important to ignore, but too risky to transform without a clear plan. And this is also where many traditional modernization initiatives begin to struggle.

Why traditional modernization often falls short

Traditional modernization efforts often struggle because they underestimate how much business knowledge is hidden inside legacy software. What starts as a technical migration can quickly become a business archaeology project.

A company may decide to rewrite an old system in a modern language, only to discover that the existing codebase contains decades of operational rules that were never formally documented. These rules are often not peripheral—in many cases, they support core production processes or business-critical operations. For example, a legacy system may contain detailed product configuration rules, manufacturing constraints, sequencing logic, or operational exceptions that determine how products are designed, assembled, or produced day to day. Some of this knowledge may still be critical. Some may be outdated. Some may exist only because of past workarounds. Without understanding the difference, modernization becomes risky.

The challenge is not only business-related. Many legacy systems were built in a very different technical era, often without modern architectural principles, clear separation of concerns, or object-oriented design. Over time, this can result in spaghetti code, duplicated logic, hard-coded rules, and dependencies that are difficult to trace. Business decisions may be scattered across many parts of the codebase, making it hard to understand where a rule starts, where it is reused, and what might break if it changes.

Big-bang rewrites are especially dangerous. They require development teams to replace a large system in one major move, often before they fully understand all dependencies, edge cases, and business-critical behavior. These projects can take years, cost more than expected, and still fail to reproduce the system’s behavior.

Another common problem is simple code translation. Moving COBOL systems to Java, PL/I to Java, old .NET Framework to .NET 8, or older Java to modern Java can be valuable, but language conversion alone is not true modernization. If the architecture remains tangled, the logic remains duplicated, and the dependencies remain unclear, the company may simply move technical debt into a newer technology stack.

So the starting question should not be: “How do we rewrite this code?” It should be: “Do we understand what this system does, what still matters, and what can safely change?” This is where generative AI can make a meaningful difference.

 

The GenAI shift: from code generation to code archaeology

The first wave of generative AI in software development was primarily focused on writing code faster. In AI legacy code modernization, the more important opportunity is different: GenAI can help teams understand old code faster.

This is where the idea of “code archaeology” becomes useful. Before modernizing a legacy application, teams need to know:

  • how modules and functions work,
  • where data is read, changed, and transferred,
  • which systems depend on each other,
  • where business rules are implemented,
  • which parts of the code may be redundant or obsolete,
  • which behaviors must be preserved in the modernized code.

 

Traditionally, this work required weeks or months of manual effort from senior engineers and subject matter experts. GenAI can accelerate the process by producing code explanations, dependency insights, summaries, and draft documentation that teams can review.

That does not mean AI-generated documentation should be accepted blindly. Generated explanations may be incomplete, misleading, or missing important context. But they give engineers a starting point. Instead of reading millions of lines of existing code from scratch, teams can use GenAI to identify patterns, ask better questions, and focus human expertise where it matters most.

The strategic value is not faster code generation alone. It is faster discovery, stronger validation, better code quality, and a safer path to change. But to create that value at scale, GenAI needs to move beyond isolated prompts and become part of a broader modernization workflow.

Agentic modernization: the new operating model

The market is now moving beyond simple coding assistants toward more agentic modernization workflows. In this model, GenAI is not only answering questions about code. AI agents can work with repositories, development tools, documentation, issue trackers, build systems, test frameworks, and enterprise knowledge sources.

They can support tasks such as:

  • code analysis,
  • dependency mapping,
  • business-rule extraction,
  • documentation generation,
  • test creation,
  • code refactoring,
  • code conversion,
  • modernization planning.

 

This matters because legacy system modernization is too complex to solve with one prompt. A large system contains many layers: application code, databases, scripts, batch jobs, configuration files, interfaces, security rules, deployment processes, and operational constraints.

Modernization agents need context from across this environment to produce useful results. That is why context engineering is becoming so important. GenAI tools are only as useful as the code, documentation, test results, diagrams, and business rules they can access and interpret.

This shift is not only theoretical. It is already visible in real modernization projects, where GenAI is being used not just to generate code, but to support discovery, validation, and controlled transformation.

 

Real-world examples of GenAI-assisted modernization

The shift is already visible in real modernization projects. The strongest examples show that GenAI is not only being used for AI code conversion. It is also being used to understand legacy systems, preserve business logic, generate documentation, map dependencies, create automated tests, and reduce migration risk.

 

IBM and Egypt’s National Organization for Social Insurance

IBM’s work with Egypt’s National Organization for Social Insurance shows the value of discovery before transformation. The organization used IBM watsonx Code Assistant for Z to explore, document, and understand existing COBOL applications and integration points. IBM reported up to a 94% reduction in the time needed to analyze and locate superfluous COBOL code and routines.

 

AWS and Experian

Experian used AWS Transform to modernize seven older .NET Framework applications to .NET 8. AWS reported around a 40% reduction in developer effort across the projects. This example is important because it shows that GenAI-assisted modernization is not limited to mainframes. Many enterprises also need to modernize large estates of older .NET and Java applications.

 

AWS and Altisource

Altisource used Amazon Q Developer to modernize 350,000 lines of legacy Java code. AWS reported a 25% increase in developer productivity and a reduction in code vulnerabilities. The case also shows the importance of connecting GenAI tools to project context, repositories, development workflows, and security practices.

 

Google Cloud and mainframe validation

Google Cloud’s mainframe modernization approach emphasizes assessment, modernization, and validation. Its documentation describes using Gemini CLI with Mainframe Assessment Tool outputs and validating modernized applications with Dual Run. This reflects one of the most important principles of modernization: the new system must be compared against the existing behavior before cutover.

 

Microsoft and agentic COBOL migration

Microsoft has described an agent-based approach to COBOL migration and mainframe modernization. The approach uses specialized agents for analysis, dependency mapping, code conversion, reporting, and orchestration. It also highlights an important limitation: human review, context management, and deterministic tests remain essential.

 

Deloitte and business-function mapping

Deloitte describes using GenAI, dependency mining, and modernization frameworks to map a large undocumented COBOL estate to business functions. In one example, Deloitte says it mapped 90% of more than 60 million lines of COBOL code to business functions in under four weeks.

Together, these examples point in the same direction: GenAI-enabled modernization is becoming less about isolated code generation and more about structured discovery, validation, and controlled transformation. That raises the next practical question: what should a safer modernization process actually look like?

 

A safer modernization pipeline: understand, validate, transform, prove

A practical GenAI-assisted modernization process can be summarized in four steps.

 

1. Understand

Start by analyzing the existing codebase. GenAI can help explain modules, generate documentation, identify dependencies, and extract business logic. This phase should be treated as discovery, not transformation.

The goal is to create a reliable map of the system before changing it.

 

2. Validate

Business stakeholders and subject matter experts should review the rules extracted from the legacy code. Some business rules must be preserved. Some may need improvement. Others may be obsolete.

At the same time, engineering teams should validate dependencies, data flows, integrations, and operational constraints.

 

3. Transform

Once the system is better understood, GenAI can assist with refactoring, translating code into newer languages, upgrading frameworks, decomposing monoliths, or preparing components for cloud native architecture.

But this work should happen in controlled increments, not as a single big-bang rewrite.

 

4. Prove

Modernization is successful only when the modernized code behaves correctly. That means running unit tests, regression tests, output comparisons, performance checks, and, where possible, parallel runs between old and new components.

In critical systems, trust comes from evidence, not from generated code alone.

This pipeline is important because it keeps GenAI in the right role: an accelerator for understanding and transformation, not an unchecked automation layer. It also helps companies avoid the most common modernization traps.

 

What companies should avoid

GenAI can make modernization faster, but speed is not the same as success. The biggest mistake is treating it as a shortcut to blind code conversion.

Companies should avoid:

  • Starting with code conversion too early—translating code before understanding the system’s behavior.
  • Skipping business validation—assuming extracted rules are correct without stakeholder review.
  • Ignoring architecture—moving old technical debt into a newer technology stack.
  • Trusting AI-generated code without review—accepting generated output without testing, security checks, and quality assurance.
  • Attempting a big-bang rewrite—trying to modernize everything at once instead of working in controlled increments.
  • Treating modernization only as migration—modernization may also mean APIs, better documentation, automated tests, stronger integration, or improved maintainability.

 

The safest approach is incremental: start with a contained area, understand it, validate it, transform it, prove that it works, and then scale the method. In other words, GenAI does not remove the discipline required for modernization. It makes that discipline easier to apply.

 

How Fabrity can help

Legacy modernization is not just about replacing old code with new code. It is about understanding what the system does, choosing the right modernization path, and executing it without putting business operations at risk.

Fabrity helps organizations move from legacy uncertainty to a clear REBUILD or UPGRADE roadmap through a structured process:

  • Free modernization audit—we assess the current system, key risks, hidden business logic, dependencies, technical debt, and modernization potential.
  • Legacy system discovery—we use GenAI-assisted analysis, engineering expertise, and architecture review to understand how the system works and where critical logic is located.
  • Business and technical validation—we help verify what must be preserved, improved, retired, or rebuilt.
  • REBUILD / UPGRADE roadmap—we translate the findings into a practical modernization plan with priorities, risks, and recommended next steps.
  • Controlled implementation—we modernize in safe increments, avoiding risky big-bang rewrites.
  • Testing and proof—we validate the modernized system through tests, output comparisons, performance checks, and business review.

 

The free audit answers the first key question: what are we really dealing with? From there, Fabrity helps turn analysis into a realistic, business-aware, and technically safe modernization path.

Ready to assess your legacy system? Contact us at sales@fabrity.pl to discuss a free modernization audit.

Sign up for the newsletter

You may also find interesting:

Book a free 15-minute discovery call

Looking for support with your IT project?

Let’s talk to see how we can help.

The controllers of the personal data are companies of FABRITY Group (hereinafter referred to as “Fabrity”) with its mother company Fabrity SA seated in Warsaw, Poland, National Court Register number 0000059690; the data is processed for the purpose of marketing Fabrity’s products or services; the legal basis for processing is the controller's legitimate interest. Individuals whose data is processed have the following rights: access to the content of your data and the right to rectification, erasure, restriction of processing, the right to object if the processing of personal data is based on consent and the right to data portability. You also have a right to lodge a complaint with PUODO. Personal data in this form will be processed according to our privacy policy.

dormakaba 400
frontex 400
pepsico 400
bayer-logo-2
kisspng-carrefour-online-marketing-business-hypermarket-carrefour-5b3302807dc0f9.6236099615300696325151
ABB_logo
Fabrity
Privacy overview

Cookies are small text files that are stored on your device using the browser. They do no harm and do not allow any conclusions to be drawn about your identity. We use cookies to make our offer user-friendly. You can find more information under our data protection notice.