
Introduction
In the race to modernise legacy systems, many organisations turn to automated code conversion tools or the latest LLM based code converters as a quick fix. These tools promise speed and efficiency but often fall short of delivering scalable, optimised results. The core problem lies in their “as-is” approach – migrating outdated code without addressing inefficiencies, technical debt, or compatibility with modern frameworks. Additionally, most of these tools fail to optimise legacy code for the efficiencies offered by modern frameworks, either by selecting inappropriate libraries or introducing unnecessary complexities.
This is where Merit stands out. We recognise that modernisation extends beyond automation—it requires a strategic, well-architected approach. By leveraging structured frameworks, advanced prompt engineering, and coding best practices, we transform legacy systems into scalable, high-performance solutions with long-term maintainability.
In this blog, we’ll examine the limitations of relying solely on automated code conversion tools, even those powered by LLMs, and highlight how Merit’s approach ensures true modernisation. While automated tools play a role, modernisation must align with strategic objectives, accounting for the constraints of these tools to deliver optimised, future-proof solutions.
The Problem with Code Conversion Tools
Automated code conversion tools have become a common solution for organisations looking to modernise legacy systems quickly. While they achieve basic conversion, they often fail to deliver long-term benefits. Here are some critical shortcomings of “as-is” code conversion:
- Lack of Optimisation – The converted code often replicates outdated logic without leveraging modern best practices, leading to inefficiencies in performance. Example: Directly converting SAS DATA steps to PySpark without restructuring results in multiple df.filter() calls instead of optimised Spark transformations, leading to poor performance.
- Increased Technical Debt – Poorly converted code introduces maintenance challenges, increasing long-term costs. Example: Legacy SQL cursor-based loops converted into Python loops instead of set-based operations create bottlenecks and high execution times, making the system harder to manage.
- Scalability Issues – Without re-architecting for modern platforms, converted code fails to support future growth or integration needs. Example: Migrating SAS scripts to Pandas without leveraging PySpark’s distributed processing leads to memory overloads when handling large datasets.
- Inefficient Code Structures and Redundant Logic – Automated conversion tools migrate code as-is without optimising control structures, removing redundant computations, or improving data handling mechanisms. Example: Legacy SQL self-joins and deeply nested subqueries are directly migrated instead of using modern SQL CTEs or PySpark’s broadcast joins, resulting in slower query performance.
- Failure to Adopt Modern Best Practices – Automated tools neglect essential programming best practices such as modularisation, efficient inheritance structures, and optimal library selection. Example: Converting SAS macros into repetitive Python scripts instead of reusable functions results in redundant code, increasing maintenance complexity.
While these tools may provide a quick fix, the long-term consequences can outweigh the initial benefits, leaving organisations with systems that are neither future-proof nor easy to maintain.
Merit’s Unique Approach to Legacy Code Modernisation
At Merit, we approach legacy modernisation differently. Our focus is on delivering optimised and scalable solutions, keeping in mind the overall business purpose of the legacy modernisation effort. Here’s how we achieve that:
- Framework-Driven Optimisation
- We enhance code conversion using internally optimised LLM-based tools, guided by structured prompt libraries and best-practice frameworks.
- Instead of direct 1:1 conversions, we apply optimisation techniques such as transforming SAS DATA steps into PySpark pipelines or refactoring cursor-based SQL loops into set-based operations to improve efficiency and scalability.
- AI-Powered Prompt Engineering Templates
- We develop AI-driven prompt templates that enforce structured, modular code transformation, ensuring adherence to modern best practices.
- These templates intelligently guide conversions by selecting optimal libraries (e.g., replacing legacy SQL stored procedures with DBT models) and enforcing modularisation, automated unit testing, and error handling to maintain consistency and reliability.
- Coding Best Practices and Maintainability
- By integrating linting tools, type hinting, and structured logging, we produce clean, maintainable code that minimises long-term technical debt.
- For example, we replace monolithic SAS scripts with reusable Python modules, ensuring efficient class structures and dependency management with tools like Poetry or Pipenv.
- Scalability by Design
- Our modernisation approach ensures systems are built for scale by leveraging distributed computing frameworks and cloud-native architectures.
- We stress-test converted workloads with large datasets, replacing inefficient Pandas transformations with PySpark DataFrames or migrating on-prem SQL workloads to cloud-native data warehouses like Fabric, Snowflake or Databricks for improved performance.
Key Benefits of Choosing Merit for Code Conversion during Legacy Modernisation Initiatives
Faster Modernisation Timelines
- Our AI-driven tools and reusable code assets in PySpark, Python, and SQL accelerate transformation without compromising quality.
- Code templates for common functions such as audit logging, exception handling, and ingestion pipelines ensure consistent implementation and reduce development effort.
Enhanced System Performance
- Performance-tested code optimised for scalability and efficiency.
- Our Spark and SQL log analysers provide real-time execution insights, enabling query optimisation, shuffle minimisation, and adaptive execution tuning to improve system response times.
Reduced Long-Term Costs
- Maintainable, well-documented code minimises technical debt and lowers long-term operational expenses.
- Enforced coding standards using automated linting (e.g., Flake8 for Python, SQLFluff for SQL) and structured documentation via Git-based markdowns ensure easier maintainability.
Future-Ready Systems
- Built using cloud-native architectures with best-fit technologies for scalability and flexibility.
- For instance, we leverage Databricks Photon for optimised Spark execution over generic open-source Spark implementations and recommend Microsoft-certified libraries when deploying solutions on Azure.
Minimised Risks and Higher Success Rates
- We address technical debt by refactoring inefficient legacy patterns, such as migrating SAS macro-heavy scripts into modular PySpark-based processing pipelines.
- Our Pre-migration dependency mapping ensures seamless integration into modern data platforms, reducing project risks and failures.
Optimised Project Delivery with Cost Efficiency
- Integrated automation reduces manual intervention, ensuring projects are delivered within budget and on schedule.
- Automated refactoring of nested legacy SQL queries into optimised CTE-based structures improves readability and maintainability, reducing rework cycles.
Integrated Test Automation for Higher Code Quality
- DevSecOps-driven pipelines incorporate Unit Testing (UT) and System Integration Testing (SIT) as part of the CI/CD workflow.
- Automated PyTest frameworks for Python-based conversions and dbt test suites for SQL migrations ensure correctness, consistency, and early defect detection, reducing post-migration failures.
Customer Success: A Smarter Approach in Action
A Merit customer, one of the world’s largest and fast-growing providers of industry intelligence solutions was struggling with outdated data systems that hampered agility and innovation. The organisation initially considered a standard code conversion tool but realised it would only replicate existing inefficiencies.
By partnering with Merit, they benefited from:
- A complete overhaul of their legacy code, optimised for modern cloud architecture.
- Scalable solutions that reduced response times by 40%.
- Significant cost savings due to reduced maintenance requirements and improved system reliability.
- Upgraded AI-ready architecture with data lakehouse implementation for structured and unstructured data management.
- Setting up the cloud infrastructure needed for both short-term and long-term scalability.
- A future-proof, upgraded system that is built for AI and advanced analytics capabilities.
For the industry intelligence client, the upgraded technology platform was a game-changer, and today, we’re leveraging the same cloud infrastructure and architecture to build new GenAI functionality to the platform.
Refactor or Rearchitect: Making the Right Choice
Modernising legacy applications often comes down to a strategic decision: refactor, rearchitect, rebuild, or replace.
Each approach varies in cost, risk, and outcomes, and the decision should align with the organisation’s long-term goals. Refactoring involves restructuring and optimisng existing code without changing its external behavior. This approach is ideal for addressing technical debt and improving performance while keeping costs and risks relatively low. It’s a practical choice when the existing architecture still meets business needs but requires enhanced maintainability and scalability.
Rearchitecting, on the other hand, involves materially altering the code to shift it to a new application architecture, enabling the exploitation of modern capabilities. While it comes with medium costs and risks, rearchitecting is often a critical step for businesses aiming to adopt cloud-native solutions or integrate advanced technologies.
For higher-impact results, rebuilding or replacing the application entirely may be necessary, though these options carry significantly higher costs and risks. The choice between myriad approaches—whether to encapsulate (expose APIs but not touch code), rehost, replatform, refactor, rearchitect, rebuild, or replace—depends on factors like the application’s current limitations, desired outcomes, and organisational priorities.
By balancing immediate needs with future scalability, Merit’s approach ensures that the chosen modernisation strategy—whether refactoring to remove inefficiencies or rearchitecting to enable transformative capabilities—delivers optimised results with measurable business value.
Conclusion
Modernising legacy systems isn’t just about migrating code; it’s about transforming it for the future. With Merit’s smarter approach, organisations gain optimised, scalable solutions that drive efficiency, reduce costs, and prepare them for the challenges of tomorrow.
Don’t settle for “as-is” code conversion. Partner with Merit to modernise your systems the right way. Contact us today to learn how we can help you achieve smarter, faster, and more efficient legacy modernisation.