Consider a hypothetical scenario: a company needs to change a shipping rule in its order management system. A developer finds the calculation in the application, a similar check in a stored procedure, and another version of the rule in an overnight job. The documentation covers only the first path. Until the team knows which customers rely on the other two, even a small change requires investigation.
A legacy system can handle day-to-day operations reliably and still be difficult to change. Problems arise when the team can no longer keep track of its dependencies, exceptions, and behavior. AI can help piece that picture together by explaining code, comparing implementations, and proposing changes. The practical goal is to identify what is holding the product back and decide which part to modernize first.
Start with a specific system constraint
A request to “modernize the platform” needs to address an observable problem. Search slows down during catalog updates. A change to shipping logic touches several modules. The new library is incompatible with the application’s current runtime version. Each constraint calls for a different solution; the age of the programming language alone does not determine the right approach.
In the Tabletki.ua project, Polytech upgraded search by integrating Elasticsearch on AWS to replace a resource-intensive indexing process. The case illustrates how a team can target a specific area for improvement. When investigating another system, it helps to define the problem just as clearly: which operations are affected, where a delay or dependency arises, and what needs to change for the user.
Trace an operation through code and data
In the shipping example, the team can give AI a focused question: where is the shipping cost calculated, and what uses the result? Within the source code available to it, the model can identify relevant functions, SQL queries, and calls to external services, compare similar formulas, and describe inputs and outputs. Each identified connection should reference a file, code symbol, or other source tied to a specific version of the system.
The resulting map may be incomplete if the analysis covers only source code and leaves out configuration, data, and external dependencies. Database triggers, scheduled jobs, or a partner’s system may control part of the behavior. The team should therefore supplement code searches with database schemas, runtime configuration, dependency analysis, and observations of actual execution. The absence of a call in the code reviewed does not prove that a function is no longer used.
A useful result is a description of a specific path: where an order enters the system, which settings apply, where shipping is calculated, what gets written to the database, and where the result goes next. Clearly mark any connections that have not been verified. For example, AI may find an alternative formula without establishing whether current customers still use it. That is a question to investigate, not sufficient grounds to delete the code.
Determine why similar implementations differ
Two similar functions may be accidental duplication, or they may support different contractual terms. AI can compare conditional logic and highlight differences in date handling, rounding, or order status. Whether the functions should be consolidated depends on which differences the business still needs. Sample transactions and input from the process owner help establish that; a code comment or method name alone is not enough.
Retry handling is a common source of mistakes. After a timeout, a client may send the same operation again. The requirement should be explicit. Within the defined deduplication window, a retry of the same operation by the same client, using the same idempotency key and parameters, must not create a second order or deduct inventory again. The request itself may be processed more than once. A key alone is not enough: the system must retain operation records, validate parameters, and prevent duplicate side effects, including when requests arrive concurrently. The Amazon Builders’ Library explains this approach and the limits on how long keys are retained.
Choose the right scope for modernization
If an unsupported dependency is the obstacle, upgrading a library or runtime may be the right first step. AI can help find affected calls and draft replacements using the documentation for the target version. The team still needs to check dependency compatibility, the build, and application behavior: a new method signature may also come with different semantics.
If updates repeatedly diverge across multiple implementations, consider a focused refactor that extracts the shared rule. This does not require a move to microservices. A separate module within the existing application can also make responsibilities clearer and reduce the number of places that must change together.
If a capability needs to evolve and ship independently, the team can consider extracting it gradually. The Strangler Fig pattern moves functionality incrementally while the old and new implementations coexist. This requires a point where calls can be intercepted and redirected. AWS notes that the approach cannot be used without that capability, and that the proxy or facade can become a bottleneck.
A full replacement remains an option that needs its own justification. It is worth comparing with incremental changes when local improvements cannot resolve the main constraint. AI can inventory dependencies and outline migration options, but the decision must account for data, integrations, team capabilities, and how the product will operate during the transition.
Use AI to prepare a focused change
Once the team has chosen an area, the task for AI becomes more specific. For example: find calls to an outdated API in the shipping module, propose equivalent calls in the new version, and flag cases with no clear replacement. The proposed change should include its assumptions and the scenarios it affects. To compare implementations, the team can also ask AI to draft test inputs and test code. Define the expected results separately, based on confirmed requirements.
Avoid changing the language, data structures, service boundaries, and business rule in the same step unless necessary. Combining different transformations makes discrepancies harder to diagnose. In the shipping example, the team could first update how the calculation is called while preserving the formula, then handle any formula change as a separate task.
Validate the proposed change with a specific scenario
The first change helps reveal how accurately the team has mapped the dependencies. For a shipping calculation, the old and new implementations can be compared using the same inputs. That requires comparable starting state, controlled responses from external services, and rules for handling differences in timestamps or identifiers. For operations that write data, run the new implementation in isolation so it does not repeat payments, send duplicate messages, or alter production data.
Traffic mirroring alone does not compare results. For example, the standard Istio mirroring mechanism discards responses from the shadow service. The setup below needs a separate mechanism to capture and compare results by operation ID. This comparison should be supplemented with concurrency, load, and failure testing.
The first step may deliver a working, modernized module. It may also show that the team first needs to split a shared transaction, clarify a rule, or prepare the data. A pilot should produce an evidence-based decision about what to do next. Whether it also delivers a new implementation depends on whether the proposed approach proves viable.
For Polytech, modernization starts with a specific product constraint. In the hypothetical shipping example, the investigation should lead to a clear decision: which implementation to retain, which differences to preserve, and where to make the first change. AI is useful when it helps assemble the evidence for that decision and prepare the engineering work within the agreed scope.
Frequently asked questions
Can we start if the documentation is outdated and the original developers have left?
Yes, provided the team can investigate the system and reproduce its behavior. Start by gathering available source code, configuration, database schemas, and information about real operations. AI can draft an initial description and questions about inconsistencies. Unclear rules should be checked with process owners. If no one can yet confirm the purpose of an important part of the system, keep that gap explicit in the plan. A confident model response cannot replace missing business knowledge.
When should we plan for rollback?
When choosing the first change, especially if it affects data. The Amazon Builders’ Library describes a staged transition between formats. First, update every component that will need to read the new data so it can read both formats, while continuing to write the old format. After verifying that condition, enable writes in the new format. From that point, rollback must target the prepared version that can read both. This sequence does not make it safe to revert to an earlier version that cannot read the new format. Verify the rollback target and data compatibility in advance. Rolling back code also does not undo an external action that has already completed, such as a payment.
How do we retain system knowledge after the first changes?
Update descriptions of rules and dependencies alongside the code, and capture important scenarios in tests. Polytech’s QA transformation case study illustrates a related practice: independent validation of critical workflows was combined with a catalog of services, owners, and dependencies, while AI supported operational workflows. Applied to modernization, this approach can help retain context between stages. The case concerns quality practices and system knowledge.
When should we bring AI into a legacy system assessment?
Once the team has a specific question and the material needed to investigate it—for example, where order status changes or how two calculation implementations differ. The first assessment should produce a map of calls and dependencies, references to the files and versions used, and a list of unverified connections and business rules. Assign a next step to each unknown: check the configuration, reproduce an operation, or confirm a rule with its process owner. DORA 2025 provides broader research context on AI in software development.
#Legacy #LegacyCode #LegacySystems #LegacyModernization #AIAssistedDevelopment #CodeRefactoring #TechnicalDebt #LegacyCodeModernization #ApplicationModernization #SoftwareArchitecture #CodeAnalysis #SoftwareMaintenance