Migrating COBOL Codes and the Struggles of Leaving Behind Special-Purpose Programming Languages
The porting of codebases coded in decades-old programming languages like Fortran or COBOL continues to gain public support, with few arguing against the notion of modernizing old systems. However, those who have dealt with large-scale code migration or legacy systems might question this enthusiasm given their traumatic experiences with porting. The age-old adage, 'if it ain't broke, don't fix it' rings true for numerous individuals across millennia, and the question remains: how can you fix something if you don't fully understand the problem?
In the case of languages like COBOL, a domain-specific language (DSL), this becomes especially relevant since it is categorically different from general-purpose programming languages. The idea of reimplementing COBOL's functionality would appear ill-advised to any logical mind.
A DSL is named as such for its specialized purpose, with numerous examples present in various fields, ranging from PostScript and SQL to GLSL (OpenGL Shading Language). These languages are designed to limit their functionality to a specific domain; GLSL, for instance, is built on C and can be viewed as a highly restricted variant of it, leading to questions regarding the necessity of DSLs if one could simply write shaders in C.
Similarly, Fortran (Formula translating system) was crafted as a DSL specifically targeting scientific and high-performance computations. First developed in 1957, it remains a top 10 language in the TIOBE index, and is commonly used for high-performance computations (HPC) in science and engineering. Fortran excels in this area because it was designed to streamline such computations and was subsequently updated to address any necessary changes over the years.
The latest standard update for Fortran was published in November 2023, joining the COBOL 2023 standard as two active and current DSLs in 2023. The power of DSLs is often underestimated as they allow simpler, focused languages to be learned and taught quickly, with fewer edge cases and simpler tooling. This is especially crucial for industries like banking and government, which rely on COBOL codebases for their business operations.
The ease of learning and teaching coupled with a concentrated focus on a specific task makes DSLs the better choice for those domains. It is possible to push a DSL into doing things unrelated to its designed purpose, but the main objective of a DSL is to provide an explicit limitation in functionality to one specific domain. The decision to write everything in a generic programming language may seem appealing to some, but the resulting code quality could potentially suffer.
Several amazing developments can be observed in the hardware design language (HDL) domain, where various alternative HDLs based on generic scripting and programming languages have emerged. Despite concerns regarding a lack of skill and code sharing, gaps are systematically filled and wheels appear to be reinvented regularly.
The longevity of existing COBOL codebases is noteworthy, as they have proven to be reliable over the years, requiring minimal maintenance and updates. One argument for porting from COBOL to a general-purpose language centers on the ease of maintenance, citing COBOL's supposed difficulty to read and write.
Recent experiments revealed that while it takes some time to learn the various divisions and syntax of COBOL, it provides an orderly and predictable development environment. The lack of semicolons and instead relying on a single period to indicate the end of a scope facilitates a smoother development process. Within a few hours, a semi-useful COBOL application was created for practical use.
In conclusion, DSLs such as COBOL and Fortran offer several key advantages when applied to their respective fields, including tailored syntax, efficiency, and productivity for domain experts. However, general-purpose languages offer broader applicability, greater integration, and a richer ecosystem, making them the preferred choice when flexibility and cross-domain solutions are required.
- Although the notion of modernizing old systems, such as porting COBOL codebases to general-purpose programming languages, continues to gain public support, the case for COBOL, a domain-specific language (DSL), becomes especially relevant given its specialized purpose and differences from general-purpose languages.
- In contrast to the concern that the age of existing COBOL codebases may make them difficult to read and write, recent experiments have shown that while it takes some time to learn the various divisions and syntax of COBOL, it provides an orderly and predictable development environment, making it still a valuable tool in the field of technology.