COBOL Development – How to Manage Legacy Code

As developers, we want to work with the latest, bleeding-edge technology, and create from scratch our setup and architecture. We love to be able to control the build without too many issues. Unfortunately, legacy code is a fact of life and we need to deal with it.

It is estimated that around 220 billion lines of COBOL are still being used today. Considering the programming language has had its heyday and it is not popular among young programmers, maintaining it has become quite a task. Companies need to find the best way to deal with their legacy code in order to keep their business operational.

Why is it such an issue? Well, because among other things, old code with vulnerabilities is gold for hackers and the cost of a data breach is quite steep for companies. That’s why it is crucial for companies to have control over the workings of their codebases and be able to keep them in good shape and protected. So, what are the strategies that work best?

What is Legacy Code?

If you are a software developer, “Legacy Code” it’s a term you’ll hear often in your career. But what exactly is “Legacy Code”? Is it just old code? Code without testing? Or someone else’s code?

When we talk about legacy code, your first thought might be of old code that is no longer needed. Yes, it may be written for operating systems that are no longer supported or widely used but legacy code is still a crucial heritage. Keep in mind that much of the software infrastructure in the world today runs on legacy code.
There is not a simple definition of legacy code. Depending on how you see it, legacy code can be understood as source codes that are derived or inherited from an earlier version of the program or software from someone else.

Why is it hard to manage?

Long-term projects are like a collage: while some parts of the code were written ages ago, others were written just a couple of months ago. Also, keep in mind that each one of these parts was written by a different developer. This can create quite a jungle for any new developer to navigate.

Usually, old code either does not have documentation to explain the logic behind it, or not one that is comprehensive enough, it has many dependencies and a hefty quantity of technical debt. That is, the code is not in the best condition, and optimizing it means large costs.

Strategies for legacy codebases?

First of all, audit the project and make a software inventory, as comprehensive as possible, that needs to list all software, hardware, applications, and containers, where available. An attempt to get the big picture and understand the purpose of the code and how data flows through the application can give you an idea where to start.

If at all possible, read all the documentation related to the codebase you are going to work on. When that is nonexistent, which frequently happens in the case of older programming languages that have gone out of fashion, like COBOL development projects.

Detect vulnerabilities and prioritize the ones that are critical. But before making any changes, the gold standard for efficient code is rigorous testing. You need to preserve the existing behavior of the application and make sure any downtime is minimal. Unit tests must run fast and not talk to the infrastructure, meaning the database, the network, the file system, and so on. Breaking dependencies and focusing on the code itself without its connection to third-party servers, etc., where possible, will speed things up.

Don’t be afraid to do unit tests even if it seems like extra work. You can find out the areas in the code that need refactoring or that can be removed. One of the best things is to eliminate the parts of the code that are unnecessary, to lighten it and make it more manageable. Create documentation as you go.

All these steps will ensure that future support for the project is easier, they will improve security and the general performance of the code.

After this, each change will be part of a process of testing that will catch any potential problems. Make sure that all the code you added is clean and optimized.

The wonders of COBOL development

Many companies, especially financial ones, like banks, and a lot of governmental organizations have extensive COBOL codebases. The programming language started its existence in the seventies of the previous century and is still going strong. Worldwide, 43% of banking systems and 95% of all ATM swipes are still using COBOL. Which is huge considering the importance of these operations.

There is an intense need for COBOL development because the pandemic has shown how code that worked great in certain conditions needs to be able to change during a crisis. As was the case of the New York state unemployment system which crashed tragically when it was most needed.

There are different views when it comes to how such databases should be dealt with. Some say that all the data needs to be migrated, but that is in some cases an impossible undertaking because of the huge number of lines of code that would need to be understood and reproduced exactly in another programming language. Not to mention that the mainframes on which COBOL runs are an extremely powerful technology that have offered for decades reliability, performance, scalability and security. No other technology nowadays is as fast and works as seamlessly when it comes to managing the incredible number of transactions, in the millions, that a bank or a governmental organization sees every day.


Nowadays, this grandfather code, which is more like a superhero in disguise, needs a bit of refreshment. This is why new developers that are happy to work with it are in great demand.

Handling and supporting legacy code is a task that many developers find tricky and time-consuming. But you don’t need to fear Legacy code. With testing and today’s software solutions, you can create a cleaner legacy for your project and your business.

Leave a Reply

Your email address will not be published. Required fields are marked *