How to choose the target for a migration from RPG
In this article, we will reflect on how to choose the target for a migration from RPG. RPG is a programming language that has been successfully used for decades to create a lot of software. Nowadays there are a large number of very large and valuable applications written in RPG, and their owners are wondering: should we move to another language?
There are several good reasons to consider this: in particular the lack of RPG developers and the interest in moving to the cloud. Yet, this is not an easy choice to make, so in this article, we’ll study the problem from different perspectives and share our findings. Hopefully, this will give concrete arguments and guidance to the many considering how to keep their software valuable for the coming decades.
Why migrate from RPG to another programming language?
We have already listed in the introduction the two more common reasons for considering migrating from RPG to another language: the lack of RPG developers and the interest in moving to the cloud. Let’s look at these two reasons individually.
The lack of RPG developers. If finding developers is always difficult, finding developers who know RPG is extremely difficult, as everyone trying to hire them would have noticed. There are way fewer RPG developers than, let’s say Javascript or Python developers, but they also tend to be older. While experience is a great quality for developers, this makes us think that 5 years from now some of them will have retired, and finding RPG developers will be even harder. To get some data, according to the TIOBE index, RPG is the 40th most popular language. Looking for RPG developers on LinkedIn we can find 73,000 of them in the entire world. For comparison, we can find multiple millions of Python developers or JavaScript developers. In other words, RPG developers are over 100 times rarer than Python or JavaScript developers, and the trend seems to be against RPG, with the average age of RPG developers being high.
RPG does not run on the cloud. If we look at AWS, Azure, and Google Cloud, none of them supports natively RPG applications. This means that RPG code, as-is, cannot be easily run on the cloud. In other words, by sticking to RPG one has to own, operate and maintain their own hardware. Scalability is more difficult as it requires buying individual IBM i series machines. The problem is when you would need one machine and a half, or when you would need a few more machines but just for a short period of time. Without the cloud, you do not have access to that flexibility.
There are additional reasons for wanting to migrate from RPG, like the uncertainty about the future of the IBM i Platform, but we think it makes sense to focus on these two.
How to migrate your codebase? Manual vs Automatic Migration
Most companies think that migrating from RPG can be done only by rewriting the code into another language, line by line. For large applications, this is simply unsustainable, and therefore many companies do not even look into migrating to another language.
We think more companies should be aware of the fact that it is instead possible to perform automatic or semi-automatic migrations to translate the business logic expressed in RPG into another language. This removes the possibility of human errors and greatly reduces the effort needed, bringing down the time necessary for the migration and the costs.
Automatic migrations can be performed by using a transpiler. We know about this topic as we have written several transpilers, including transpilers from RPG to other programming languages. If you want to learn more about how we design transpilers you can find more in this article: How to write a transpiler.
What is written in RPG?
RPG has been used to write mostly ERP or enterprise software. According to our study, two-thirds of the applications written in RPG belong to this category.
This is something to take into account when considering the language to migrate to: it should be a language well suited for writing ERP software.
RPG is also commonly used to write financial software, with roughly 30% of RPG applications falling in this category.
What characteristics should a candidate programming language have?
When picking a good candidate language for migrating away from RPG we should, first of all, consider a language that allows us to solve the two main challenges we have with RPG: lack of developers and lack of support for deployment in the cloud.
Let’s see which languages we can consider based on these two factors.
Popularity
If the reason for migrating from RPG is the lack of developers, we should consider only languages that have at least 10 times the number of RPG developers and languages which are ideally gaining popularity, so that the trend indicates that we will be able to find developers familiar with that language in the midterm.
To find popular programming languages we proceeded in this way:
- We first of all compiled a list of candidates. To do this we looked at several resources, including the TIOBE index.
- We then excluded the languages which were clearly not suited for the task as they were not general-purpose languages (for example, we excluded SQL, HTML, CSS).
- Finally we estimated how many developers were familiar with that language. To do that we used various sources: from LinkedIn to surveys and articles. Assessing the number of developers who are familiar with a certain programming language is very difficult, but for our needs, it is sufficient to get the right order of magnitude, and that is much easier.
The result of this process is the following table:
Millions of developers | At least 10 times more developers than RPG? | |
Python | 6.0-6.6 | Yes |
C | 2.4-2.5 | Yes |
Java | 4.1-6.0 | Yes |
C++ | 2.8-3.1 | Yes |
C# | 2.9-3.5 | Yes |
Visual Basic | 0.5-0.6 | No |
Javascript | 7.7-8.5 | Yes |
Go | 1.4-2.4 | Yes |
Ruby | 0.6-0.8 | No |
Rust | 1.0-1.1 | No |
Swift | 0.6-0.9 | No |
RPG | 0.06 – 0.08 | No :D |
Ability to run on the cloud
The second aspect to consider is which languages can “run in the cloud”. To do this we looked into which languages are supported by the three main cloud providers: AWS, Azure, and Google Cloud. We then picked the languages which are supported by at least two cloud providers, as this gives us some reassurance that at least one major provider may offer support in the mid-term period. I.e., even if one provider removed support, we will still be left with at least another provider.
This is the result we got:
AWS | Azure | Google Cloud | Supported by at least 2 cloud providers | |
Python | Yes | Yes | Yes | Yes |
C | Yes | No | No | No |
Java | Yes | Yes | Yes | Yes |
C++ | Yes | No | No | No |
C# | Yes | Yes | No | Yes |
Visual Basic | Yes | Yes | No | Yes |
Javascript | Yes | Yes | Yes | Yes |
Go | Yes | No | Yes | Yes |
Kotlin | Yes | Yes | Yes | Yes |
Ruby | Yes | No | Yes | Yes |
Rust | Yes | No | No | No |
Swift | Yes | No | No | No |
Which candidates are worth considering as a replacement for RPG?
Based on what we have seen, let’s see which languages are both popular and have sustainable support for the major cloud providers.
Here there are our results:
Popular | Cloud support | Worth considering? | |
Python | Yes | Yes | Yes |
C | Yes | No | No |
Java | Yes | Yes | Yes |
C++ | Yes | No | No |
C# | Yes | Yes | Yes |
Visual Basic | No | Yes | No |
Javascript | Yes | Yes | Yes |
Go | Yes | Yes | Yes |
Kotlin | No | Yes | No |
Ruby | No | Yes | No |
Rust | No | No | No |
Swift | No | No | No |
RPG | No | No | No :) |
So these are the languages that we believe it makes sense to consider when migrating away from RPG:
- Python
- Java
- C#
- Javascript
- Go
In the next section we will discuss each of these languages individually.
How to pick the right target language?
We have seen that there are 5 general-purpose programming languages that are used by millions of developers and supported by cloud services providers. This however does not tell us anything about them being a good fit for replacing specifically RPG. This is what we are going to dive into in this section.
Python
The Python language has a vibrant community, and, despite being over 30 years old, it is growing in popularity.
What are some of its strong points?
First of all, it is reasonably easy to learn. We think this in particular a good factor for it to be used as a replacement for RPG. The reason is that many RPG developers can be considered good analysts who also double as developers. This is to say that their domain knowledge, that is, their ability to understand requirements and provide business solutions, is often more important than their knowledge of the latest programming paradigm. For this kind of user, Python would be a great fit. We expect people who are today defining business logic for their ERP written in RPG to prefer Python with respect to the alternatives in this list.
A second advantage of Python is the rapid development and good productivity that comes from it. This is particularly useful when working in close contact with clients and having the need to prototype solutions quickly to quickly obtain feedback from the clients. Again, a great fit for developers writing business logic inside ERP systems.
As a testament to the good fit of Python for writing ERP software, we can point to existing ERP platforms being written in Python, notably Odoo.
A weakness of Python is instead absolute performance. In general, programs written in Python are not as efficient as programs written in Java or C#. That said, this problem can be circumvented through the adoption of appropriate C extensions, and in this way, libraries like Numpy allow us to obtain good performance also in Python.
Java
Java is a very stable language, created in 1995, and used by millions of developers. It has a very large ecosystem: there are many different great IDEs for Java, and an incredible amount of open-source libraries and frameworks. All of these characteristics make Java a very solid and reliable choice.
Java has arguably been the primary language for writing enterprise applications in the last decades. It is a language that helps prevent errors and offers good performance. Late innovation, like GraalVM and Quarkus, permits to make Java even faster.
In general, we would suggest moving from RPG to Java if you are writing applications in the finance domain, where catching errors and having good performance can be particularly important. In that field the need for rapid prototyping can not be as important, so the fact that Java requires more “ceremony” for writing applications compared to Python would not be a hurdle.
C#
C# is arguably a very well-designed language, which has learned from Java and improved upon it. It has also been a language that evolved more rapidly than Java, until recently and the result is brilliant. C# has also a good ecosystem. It may not have as many libraries as Python, Java, or Javascript, but quality libraries and frameworks are available, and the ecosystem seems stable.
C# is not a language on the rise, but at this stage, there are definitely many young developers learning it.
Compared to other languages C# has traditionally been connected to one particular operative system: Windows. This has changed in the last few years.
A platform that demonstrates the ERP solutions which can be written with C# is Microsoft Dynamics 365 Business Central (formerly Microsoft Dynamics NAV).
Despite its advantages, probably in many circumstances, Java would be a better choice than C#, unless your organization is specifically oriented to the Windows OS, or other Microsoft solutions, or if you have already a large number of C# developers in-house. If that is your situation, you can move from RPG to C# confidently.
Javascript
Javascript is probably the most popular programming language in the world. Another huge advantage of Javascript is the incredible number of libraries available.
Another important advantage is that, if developers learn Javascript to write your business logic, they will be able to use the same language also to write web applications that may act as a frontend. For companies with very small development teams, this may be a big advantage, while it could be less relevant for larger organizations we may have different teams for writing the business logic and the frontend.
The main disadvantages of Javascript are:
- The instability of the ecosystem: new building tools and frameworks emerge and are abandoned, and the best practices vary quickly. This is not an ideal environment for companies looking for stability. The companies that today are considering moving from RPG are typically favoring stability over being constantly on the edge of new innovations.
- The language is not designed with solidity in mind, but more for quick prototyping and for building applications where errors have limited consequences. In other words, if a button does not display in the right place it is not a big deal, while if an invoice cannot be generated that would be an issue.
- Javascript is not designed for parallel computations and large calculations. This would make it a terrible implementation language for large batch jobs currently being executed on the IBM i Series.
All in all, we believe that the disadvantages make Javascript not a good fit for replacing RPG. It could make sense to consider it for small organizations who would appreciate how easy it is to recruit developers (and possibly also developers looking for lower salaries) and to hire a few developers who could both write the business logic and the frontend.
Go
Go is a language with growing popularity, and used by a large number of developers, especially in Asia.
Go is a system language, typically used to write efficient code with high parallelism. We did not find many examples of enterprise software being written using Go. Go is also a rather low-level programming language.
Go does not seem to have such a strong ecosystem as the other languages considered, and we cannot find a reason to recommend migrating from RPG to Go. We believe that, of the candidates we considered, Go would be the worst choice in most cases.
What to do next?
If you are considering migrating from RPG to another language, we hope that the information presented was useful to you. We would love to hear your feedback.
At this stage, you may be able to make a choice and decide to migrate from RPG to Python or to Java. In that case, great! You may be interested in learning how we typically plan for language migrations. If that is the case you may want to read this article: Audit & Analysis for Language Migration Project.
If you have restricted the choice to a few candidates and you would like to discuss the alternatives with us, feel free to reach us and we will help you reach a decision.
Summary
In this article we have seen to which language it makes sense to migrate our RPG codebases. We have considered the main reasons for migrating away from RPG (lack of developers and cloud support) and based on that we identified the 5 best candidates for replacing RPG: Python, Java, C#, Javascript, and Go.
We then looked at each of them and we can conclude that in most cases Java or Python would be the best choices. In some specific cases also C# could make sense, while Javascript and Go are typically not the best choice, unless there are very specific reasons.
Published on Java Code Geeks with permission by Federico Tomassetti, partner at our JCG program. See the original article here: How to choose the target for a migration from RPG Opinions expressed by Java Code Geeks contributors are their own. |