The year is 2025, but deep inside a bank’s core system, a COBOL program from 1975 still processes transactions. The developers who wrote it? Long retired. The documentation? Either missing or reads like an ancient script. Now, a new generation of engineers is tasked with maintaining legacy code written in COBOL, RPG, or even early Java—languages they never learned in college.
The scenario isn’t just an inconvenience; it’s a growing crisis. Businesses worldwide still rely on these legacy systems and their tangled legacy code for mission-critical operations—banking transactions, insurance claims, and government services—but the pool of skilled developers who can maintain them is shrinking. Companies face a choice: modernize or risk system failures, compliance issues, and mounting technical debt.
Modernization has become a scary buzzword. But what if modernization didn’t have to be this hard? What if AI can make it less complex?
The Snowball Effect of Maintaining Legacy Code
I have the privilege of working with very talented and senior (but not seasoned) developers supporting clients in the modernization of mainframe, JAVA codebase, PLI, etc. When I spoke with them about their “legacy code” experience in helping clients in the modernization process, they turned to one of those three approaches:
- Manual Code Refactoring – A painstaking process where developers rewrite outdated code line by line. It is slow, expensive, and error-prone, especially without comprehensive documentation.
- Lift-and-Shift Migration – Moving legacy applications to the cloud without changing their architecture. While this may offer short-term cost savings, it doesn’t address the fundamental maintainability issues.
- Full System Replacement — This involves a complete rewrite of the application in a modern language. It is the most expensive and risky approach, often leading to long development cycles and operational disruptions.
Each method requires massive amounts of time, resources, and specialized knowledge—things in short supply. Worse, they often introduce new problems, from compatibility issues to business disruptions during the transition. Furthermore, every legacy system carries an invisible burden: technical debt—see this paper for an in-depth technical definition and a framework to measure it.

At first, the debt seems manageable. A few workarounds here, a patch there. But over the years, as new features are bolted onto an aging architecture, the codebase becomes more complex to modify, and maintenance becomes a survival game. The first step in modernization is to make technical debt visible. I like this blog article by Maria Vechtomova because it offers a very pragmatic approach to assessing the business impact of technical debt.
How AI is changing the game: Tools and Roadmap
AI-powered tools are like kitchen gadgets that promise to save time—some are revolutionary, others clutter the counter. Do you remember those senior developers that I mentioned before? They are experienced folks, and it turned out that they have already experimented extensively with various tools and technologies out in the market. We sat together and tried to outline some areas where dramatic and clear improvement occurred. AI serves as the missing bridge between old and new systems by:
- Extracting and documenting business logic: AI can analyze existing applications to automatically generate technical documentation, ensuring that critical knowledge isn’t lost as veteran developers retire. Do you want one example? My colleague Tomislav Mašić has written an interesting piece about WA4Z, a tool that offers intelligent query responses and task automation on the IBM Z platform. Imagine having precise answers to your mainframe queries and the ability to integrate your documentation, all while automating tasks effortlessly with a specialized RAG framework.
- Optimizing code structure: AI-driven refactoring identifies and restructures inefficient or outdated code segments for better performance, security, and maintainability. If you want a pragmatic and honest view of the available tools and their performance, check out Kresimir’s blog and updates. He is a veteran on the scene who enjoys scanning through the breezy AI tools to understand if they deliver what they promise.
- Enabling step-by-step modernization: One of the first hurdles of modernizing legacy codes is understanding what is inside the black box of legacy code sources and their interdependencies. It is a mess you do not want to touch because who knows where you could end up. But AI here can shine, for example, in generating frameworks that support developers in understanding the web of interdependencies, business context’s entities, and code blocks. Artificial intelligence can help semi-automate the generation of knowledge graphs, which embed, for example, information about the system architect, the function of code segment, etc. These tools can feed into the RAG pipeline and enhance the understanding stage of each modernization project. If you want to read more about it, do not miss Hrvoje’s blog.

AI-enhanced tools may make the modernization process easier. However, we need to clarify one point: un-complexing one part of the equation with AI may make another component of modernization projects more complex. Artificial intelligence introduces new bottlenecks, such as technical debt costs for the AI layers. I leave you exploring this issue with Alberto Danese’s blog (In Italian, my beloved language, and in English for the rest of the world).
As I have witnessed often in these months, AI is a bridge between old and new. Regardless of the approach, AI-assisted legacy modernization is not a one-click solution—it requires strategy, validation, and adaptation. The key to success is:
- Merging business and technical expertise — business logic is as critical as code structure.
- Being realistic about AI’s capabilities — it accelerates, but doesn’t replace, modernization efforts.
- Taking an incremental, risk-mitigated approach — small wins lead to scalable transformations.
Long live the ‘old code sources!’ Like a well-aged recipe passed down through generations, with the right strategy, AI, and expertise, legacy code won’t just survive—it’ll be the star dish of the modern tech kitchen.