System integrations are an integral part of any enterprise platform. If due diligence is not followed, business logic can easily leak into the integration layer. This can result in a poor system architecture, making it harder to maintain and implement any future requirements.
There are a number of ways this issue can be tackled, but one particularly interesting new method is to use generative AI. This might sound surprising given how new the technology is — not to mention the well-documented challenges around accuracy and hallucinations — but with the right approach and appropriate human oversight, it can be very effective.
Specifically, a two-step approach is recommended:
In the first step we analyze legacy code to understand and extract the system’s business logic.
In the second step we use that analysis to generate the code in the desired technology stack using the GenAI tool.
The generated code is then reviewed and refactored manually to make it production-ready.
Legacy code modernization framework
Putting it into practice
To demonstrate how this works, let’s apply this approach to an SOA-based application integration to modernize a legacy system built using Tibco BW (Business Works). Tibco BW is one of several solutions used to integrate business workflow(s) that span various enterprise platform subsystems.
There are multiple reasons for wanting to move away from this legacy system, including:
Lots of code redundancy within the application with no reuse
A complex system architecture that’s difficult to maintain and adapt to changing business needs
Licensing costs involved with periodic renewal(s) (~$400-$1500 per month for TIBCO cloud integration subscription)
By using generative AI in the two step process outlined above, we were able to modernize legacy Tibco BW workflows, moving it to a microservices-based architecture. When a typical enterprise system contains hundreds or even thousands of integration workflows, the value of generative AI should be obvious — it can handle modernization on a huge scale that would be incredibly difficult to do manually.
Architecture diagram
Step one: Analyzing legacy workflows
To analyze the workflow, we passed a Tibco BW XML file through the GenAI-based tool. The technical implementation team compared the tool output to the workflow implementation — their review determined that the analysis of the workflow was accurate.
Step two: Generating new code
Next, the analysis was passed through the tool again, this time to generate the Spring Boot code and tests we needed. With a quick code review — from a design and implementation perspective — and a small amount of refactoring by the development team, we were able to quickly analyze and modernize the entire workflow. For this workflow, based on the team’s experience of using a conventional approach to modernizing the workflow and comparing that to the Gen AI-based approach, we could conclude that Gen AI based approach helped us save about ~60% of analysis and development effort. This implies that Gen AI based code modernisation approach would result in significant effort saving particularly in analysis and code development.
Process flow
It’s worth noting that this process was not completely smooth. There were some challenges when using GenAI that we had to address.
The output from the GenAI-based tool needs to be continuously refined. This is done by tuning the prompt given to improve accuracy.
The output of a GenAI tool has to be properly reviewed, improved and appropriately refactored before it can be merged to the main branch.
The GPT-4 model has a limit of either 8K or 32K tokens, including the prompt. We had to plan for ~20% of work to be done using another approach, like breaking down the huge xml or manually refactoring the workflow from the ground up.
Due to compliance and intellectual property issues, existing code couldn’t leave the organization boundary. To tackle this, we hosted a dedicated GPT-4 model on the organization's infrastructure
For large enterprises, the sheer volume of integration flows and the subsequent implementation effort required may become the biggest roadblocks. That’s why GenAI-based tools can be really helpful.
Here are the key takeaways that I think others can learn from our experience:
GenAI-based tools can help you quickly analyze legacy application code written in old languages/tools with good accuracy.
Using GenAI in a legacy modernization initiative can help speed up analysis, and reduce the amount of effort needed to refactor or write new code.
You can also leverage the tool to build the required safety net, consisting of unit/integration tests, in the modernized codebase.
Although we used this framework to modernize TIBCO BW workflows, it’s worth noting that it can also be used to modernize code written in other languages and frameworks. For example, this framework could be used to:
Modernize the integration workflows built using Mule ESB
Analyze and modernize code implemented using old technologies like COBOL on mainframes
Analyze code written in old stacks like Fortran and JAX-WS
and many more….
Modernizing an application built on a legacy stack can be very challenging. This sometimes deters organizations from actually doing it — even when modernization could deliver substantial value. Fortunately, Gen AI-based tools can help make these challenges more manageable. From system analysis to development, using generative AI in legacy modernization has the potential to ensure modernized applications are built on quality code and robust architectural characteristics, without consuming all your time and resources.
Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.